My goal is to set profit target to BE +/- 1 if entry bar is not moving (close equal or below/above close of signal bar).
My test code for illustration (OnBarUpdate Method):
...
int barSinceEntryLimit = 0;
if (!Historical)
barSinceEntryLimit = 1;
if (isLongTrade && BarsSinceEntry() == barSinceEntryLimit && ( Close[0] <= Close[1] ))
beExitLong = true;
if (isShortTrade && BarsSinceEntry() == barSinceEntryLimit && ( Close[0] >= Close[1] ))
beExitShort = true;
...
Can someone please explain why BarsSinceEntry() works different on historical / real-time data?

Comment