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

Re: More Possible Errors in OddBall



PureBytes Links

Trading Reference Links

Frankly, I cannot help but feel a little vindicated... I've been seeing
these inconsistencies for months now... and most of the responses to my
queries (not from Bob)... have been a polite brush off at best.

Add this to the problem of TS not calculating (especially on shorter
intervals) on a particular bar if there is no valid price change (tick), and
the whole notion of calculating on a time series and/or using multiple
data's becomes a crap shoot.

Now, perhaps your system concept is already robust enough to absorb such
vagueness (and more power to you!), but it's frankly disheartening to be
honing one's system skills when such errors can cause such erratic backtest
results. How many man-hours of time have been collectively blown on the
Omega list by this nonsense?

I've been a bit busy lately, but this is as good a time as any to share a
reasonably simple method I found to work past the "missing interval" problem
that I spoke of a while back. This solution was based on attempting to
create a system using intervals of 10 mins and above (for example), on a
chart that is 2 mins or less, including tick intervals.... in order to study
the advantages of a higher compression as noise filter, vs. a shorter
interval for stops or reversals or whatever other method might benefit from
more granulatity. For my own reasons, I didn't want to mess with multiple
data's, *particularly* when trying to track down these darn inconsistencies
that kept cropping up. The solution, although tailored to my particular
needs, may be of value in an oddball or any other type system.

So, the goal is to make a system calculate every 10 mins on a 1 min chart.
The seemingly obvious method is just to artificially create your "intervals"
and calculate your variables using that (if you have to track a channel,
just reset the 1 min vars every interval and pass the accumulation to a set
of 10 min vars). However, this whole notion falls apart completely if, at
the precise 10 min. "interval", there is no updated price (tick)... suddenly
the whole notion of using Time as a trigger is void. And yes, it happens
plenty of times.

The solution is to use code similar to following (explanation after code):

StartTime = TimetoMinutes(Sess1StartTime);
FirstTime = StartTime + Interval;
NowTime = TimetoMinutes(Time);
FracTime = FracPortion((NowTime - StartTime)/Interval);
FloorTime = Floor((NowTime - StartTime)/Interval);


if NowTime >= FirstTime then begin {begin checking at end of 1st interval or
later if missing}

    if FracTime = 0 then begin    {exact interval bar exists}

        {---Pass 1 min vars to 10 min vars here---}

        ExactTime = True;    {if exact int. exists, flag to reset 1 min vars
next bar}

    end else                    {assumes interval bar missing}

    if FracTime < FracTime[1] OR FloorTime <> FloorTime[1] then begin {yup,
we missed it!}

        {--Pass 1 min vars[1] from 1 bar ago to 10 min vars here--}
        {--Start to accumulate first 1 min vars here--}

    end;
end;

if ExactTime = True then begin
    {--Start to accumulate first 1 min vars here if exact interval hit--}
    ExactTime = false;
end else begin
    {--Continue to accumulate 1 min vars otherwise --}
end;

----------------------------------------------------------------------------
------------------------------------

There are two errors to trap. The first is if the bar representing the end
of the longer interval is missing. That is caught by FracTime < FracTime[1].
Logic being, as the 1 min bar counts up to 10, the fraction will always
increase... if the 10 min bar exists on the 1 min chart, the fraction = 0...
otherwise, we look to see the fraction drop if it blows past it, which will
occur except in the following case.

The second error takes care of the rarer occurance (but I've seen it
happen), when there is no price change for exactly the next entire longer
interval (in this case 10 mins). In that case, taking the Floor of the
division reveals when we've passed the longer interval no matter what.

Finally, we have to add a flag (ExactTime) so that if we blow past the exact
interval, we pass the previous good 1 min vars to the 10 min vars and begin
accumulating the next 1 min vars from this bar (which is what TS does if you
had simply used a 10 min chart...). Otherwise, if we hit the interval on the
nose, we pass along the current 1 min vars and use the flag to reset the 1
min vars on the next bar.

Now, if you want to do this on a Tick chart, it's just a wee bit different.

Since the best you can hope for in TS is a timestamp down to the minute, the
best we can do is to detect when the minute time stamp crosses over into the
1st tick of the 1st minute of the next 10 minute bar... got it ?  ;~)

So, first we change FirstTime to the following:

FirstTime = StartTime + Interval + 1;

This moves all the transition checks to the first minute of the next 10
minutes. To detect the first tick of that first minute, we change FracTime
to:

if FracTime = 0 AND Time <> Time[1] then begin

.... and....

if (FracTime < FracTime[1] AND Time <> Time[1]) OR (FloorTime <>
FloorTime[1] AND Time <> Time[1]) then begin

NOTE: I have not yet checked out the FloorTime error trap on a tick chart so
that fragment of code is untested. If in error please let me know.

All other code and rules regarding when and where to pass and reset vars
should be the same.


Pain in the butt I know, but it seems to work...

Best regards,

Gene Pope