I am using inside bar to trigger entry. The current bar [0] is being eventuated to see if it finishes as an inside bar.
I set CalculateOnBarClose = true.
When backtested, the strategy works perfectly, submitting entries as desired. However, when the strategy goes live, it evaluates the current bar still in painting and submit stop orders immediately before the [0] bar completes. I can only conclude the CalculateOnBarClose = true has no effect in live trading.
The pieces of code are pasted to demo the logic.
Any suggestions are welcome.
protectedoverridevoid Initialize()
{
… .......
CalculateOnBarClose = true;
}
protectedoverridevoid OnBarUpdate()
{
....
if (High[0]<=High[1] && Low[0]>=Low[1])
{
lowTrigger = Low[1];
highTrigger = High[1];
entryOrder=EnterLongStop(3*minUnits,highTrigger+1*TickSize,"Long1");
}
....
}
Comment