[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subtle Bug Realtime vs Non-Realtime



PureBytes Links

Trading Reference Links

I've got a bug that shows up running real-time that doesn't show when
applied to historical data.  The code simply plots the previous day's High
and Low on the current day.


if date <> date[1] then begin
    prevDH = currentDH;
    prevDL = currentDL;
    currentDH = H;
    currentDL = L;
end;

if H > currentDH then currentDH = H;
if L < currentDL then currentDL = L;

plot1(prevDH, "prevDH");
plot2(prevDL, "prevDL");


When running real-time, sometimes, but not always, this code marks the first
bar of the current day's high as the prevDH and the first bar of the current
day's low as the prevDL.

I've got the ES in data1 and NQ in data2.  The indicator is applied to
data1.  I've got a feeling the problem has something to do with running
realtime on a multidata chart.  Perhaps it has something to do with the
sequence of ticks that come in.  For example the first tick is from data2 vs
first tick from data1.  I can't quite wrap my brain around this.

Anyone have any thoughts on how to make this work correctly.

thanks,
justin