TimBars is set to 60 as a parameter
protected override void OnBarUpdate()
{
if (Bars.BarsSinceNewTradingDay < TimBars)
{
clip = 0;
}
else if (Bars.BarsSinceNewTradingDay == TimBars)
{
clip = 1;
}
else { // Code should not have reached here until 9:30, and clip should have been reset at the end of the first bar at 8:31
if (clip > 1e-10)
EnterLong(1);
}
return;
}
Is there a bug in the return of Bars.BarsSinceNewTradingDay when the template starts? It looks like it thought it was still the end of the previous day...
The strategy ran correctly the day before, did something not get cleared? E.g. could the first OnBarUpdate of the session not have reset BarsSinceNewTradingDay yet? The strategy automatically closes at the end of the day - could that screw up resetting the time?
There is nothing in the trace log prior to the order submission that would indicate anything amiss.
If NT thinks the opening of the first bar of the day it should execute the last bar of the previous day, this would explain buggy behavior I had seen in live execution of the SampleMACrossOver years ago, but was supposedly fixed.
Comment