I try to resolve an issue in my script strat with reading from files long time but cant get it.
I want to read from a csv file at a certain time when enabling the strategy and plotting SR-lines with the values from CSV file. Then after market open I want to read it again and plot the new SR lines. But this 2nd read and draw doesnt work. The lines from the premkt session persists. I have
if(readlevelspm == true && readlevelsmkt == false && ToTime(Time[0]) > 60000)
{
foreach(LineInfo item in _mySRvalues)
{
readlevelspm = false;
readlevelsmkt = true;
if(item.LevelTextSort == "L1" && item.LevelValue > 0)
{L1L = item.LevelValue; DrawHorizontalLine("L1L", false, item.LevelValue, Color.SaddleBrown, DashStyle.Dash,2);}}
if(item.LevelTextSort == "L2" && item.LevelValue > 0)
{L2L = item.LevelValue; DrawHorizontalLine("L2L", false, item.LevelValue, Color.SaddleBrown, DashStyle.Dash,2);}
}
if(readlevelsmkt == true && ToTime(Time[0]) > 93100 && ToTime(Time[0]) < 93500 && L3L == 0) // the SR level 3 appears only at 930, so I thought this additional condition
{
foreach(LineInfo item in _mySRvalues)
{ readlevelsmkt = false;
if(item.LevelTextSort == "L1" && item.LevelValue > 0)
{L1L = item.LevelValue; DrawHorizontalLine("L1L", false, item.LevelValue, Color.SaddleBrown, DashStyle.Dash,2);}}
if(item.LevelTextSort == "L2" && item.LevelValue > 0)
{L2L = item.LevelValue; DrawHorizontalLine("L2L", false, item.LevelValue, Color.SaddleBrown, DashStyle.Dash,2);}
if(item.LevelTextSort == "L2" && item.LevelValue > 0)
{L3L = item.LevelValue; DrawHorizontalLine("L3L", false, item.LevelValue, Color.SaddleBrown, DashStyle.Dash,2);}
}
But it doesnt plot the new values for level1 and 2 and doesnt plot level3. The SR levels from time 60000 persits. I have to disable and enable the strategy, only then the correct levels L1, L2 and also L3 is there with the values after 93000
What am I doing wrong here with plottting referring time and flag?
Thank you
Tony
Comment