I draw horizontal lines in my chart and calculate in my script with values from a csv file. All works fine but I have the problem that when the csv files calculates new levels (from excel) then I have to refresh in NinjaTrader with F5 so that the values are to use in the script.
I tried to do this automatically in onbarupdate with
if(readlevels == 0 && ToTime(Time[0]) > 93100)
{foreach(LineInfo item in _filevalues)
{readlevels = 1; // set int for no more reading
if(item.LevelText == "L1" && item.LevelValue > 0)
{L1L = item.LevelValue;}
f(item.LevelText == "L2" && item.LevelValue > 0t)
{L2L = item.LevelValue;}
......
......
if(item.LevelText == "L1" && item.LevelValue > 0) {DrawHorizontalLine("L1L", false, item.LevelValue, Color.Peru, DashStyle.Dash,1);}
if(item.LevelText == "L2" && item.LevelValue > 0) {DrawHorizontalLine("L2L", false, item.LevelValue, Color.Peru, DashStyle.Dash,1);}
}
but it doesn´t draw the new levels at that time. I have to press F5. How can I have the updated values working in the script without pressing F5? What I´m doing wrong?
Thank you
Tony
Comment