I wrote an indicator that plots the Overnight's Open, High and Low. When I use this indicator in a strategy, during hours between 1700 and 0830, any condition using those plots works perfectly. But when I attempt to use those plots (ONOpen, ONHigh, ONLow) between 0830 and 1700 (for example: if ( CrossBelow(Low, Overnight1.ONOpen, 1)) the strategy will take the trade at 0831 every time even though the condition is false.
I used print statements to monitor this behavior. Is there another method I can use to help me find out why the indicator plots works only during the Overnight session and not the RTH session?
Thanks.
protected override void OnBarUpdate()
{
if(BarsInProgress != 0 )
return;
if (CurrentBars[0] < 1)
return;
if (Times[0][0].TimeOfDay >= new TimeSpan(17, 00, 00) || Times[0][0].TimeOfDay <= new TimeSpan(08,30, 00))
{
ONOpen[0] = CurrentDayOHL1.CurrentOpen[0];
ONHigh[0] = CurrentDayOHL1.CurrentHigh[0];
ONLow[0] = CurrentDayOHL1.CurrentLow[0];
}
}
Comment