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

Re: EL Question - Missing Data Condition



PureBytes Links

Trading Reference Links

> >I want to detect those bars on which Data2 is missing:
> Try:
>   if Time of data1 <> Time of data2 then ....

Nice, Bob.  Very clean solution.

ndtrader and others who run into situations like this:  the best way 
to find a solution (other than having somebody solve it for you on 
the Olist :-) is to poke around and see how things work in TS.  Try 
charting things using the Custom N Line indicators.  If you'd tried 
that, you would have seen that your guesses of "Close Data2 = 0" &etc 
wouldn't work.

For example, say you plot something like this in "Custom 2 Lines":

  Input1:  Close
  Input2:  Close of data2

You would see that the Close of data2 doesn't go to zero when there's 
no bar in data2; it just repeats the previous value.  You might not 
have gotten the insight that Bob did, of using Time instead of price, 
but you would have avoided experimenting with a dead end.

Bob's solution works very nicely because Time (unlike price) is 
guaranteed to change on every bar where there's data.  It wouldn't be 
guaranteed to change if this was a *tick* chart, but you can't use 
multiple data streams with tick charts.  Furthermore, if there's data 
on both data streams, Time is guaranteed to be the same on both data1 
and data2 (assuming they use the same bar size).  If Time on data2 
falls behind Time on data1, you know there must be a gap in data2.

Now, just for completeness, what happens if there's no data on data1 
but there is on data2?  There you're out of luck.  Indicators and 
systems only get executed at the close of a bar on *data1*.  So if 
there's no bar on data1, your indicator code won't see it.  It won't 
get called until there IS a bar on data1.  So Bob's test won't do you 
any good in this case -- try the "Custom 2 lines" test again.  You'll 
see that Time on data1 & data2 is always the same (assuming you never 
have gaps in data2), because the indicator code doesn't get called 
during the gaps in data1.

Gary