This isn't a code question, more of an approach question.
I have an indicator I am working on that has a lookback period. The crossover period from Historical to real time is giving me fits.
The calculation is complicated and has ramifications for many bars (even beyond the lookback period).
Historical data works great but the crossover requires some of the calculations to be on the price[0] and some on [1] (I am using FirstTickOfBar).
I have found using
int barOffset = (Historical || CalculateOnBarClose) ? 0 : 1;
and then using barOffset in place of [0] or [1] for real time solves everything but the crossover period.
I have also found it helpful to color the first realtime bar when debugging a new indicator.
I always feel with issues like this there is a simple solution that is eluding me. Does anyone have any suggestions as to how they deal with this issue?
Best Regards,
Scott

Plus ninja have several bugs about testing and i don't have time for deal this rubbish. For example suppose you open 1.1.2011 - 30.1.2011 historical data and put the strategy on chart and look at output window there is no error or warning and start market replay, after a time you see strategy don't create orders then look again output window you'll see error about one day. What is interesting? this day before 30.1.2011(that time is time to start replay). I don't understand how it can be?
Comment