I have indicator with:
AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1, MarketDataType.Last);
in OBU i have:
if (BarsInProgress == 1)
{
if (BarsPeriod.MarketDataType != MarketDataType.Last)
return;
// problem 1
Print(State.ToString()+" "+CurrentBar + " | " + BarsArray[1].GetAsk(CurrentBar) );
// problem 2
Print(State.ToString()+" "+CurrentBar + " | " + GetCurrentAsk(1) + " " + BarsArray[1].GetAsk(CurrentBar) );
}
(questions 1)
The problem 1 is that the values are different on historical and realtime.
For example, in realtime it might print:
Realtime 64 | 90.75 Realtime 65 | 90.75 Realtime 66 | 90.75
but if refresh chart, then sometimes it shows different:
Historical 64 | 90.75 Historical 65 | 90.5 <-------------- different Historical 66 | 90.75
(question 2)
the problem 2 is that in realtime, these two values differ from each other (only rarely they are same). Why ? what is the correct way to collect the ask data correctly for specific bar-index? (i am testing MarketReplay too, and i am describing the problems what i see).
i've tried this, but either this seems incorrect:
double ask = State==State.Realtime ? GetCurrentAsk(1) : BarsArray[1].GetAsk(CurrentBar);
Can you advise me?
Comment