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

Re: Study to Filter Bad Ticks/Gaps/etc.



PureBytes Links

Trading Reference Links

Val Clancy wrote:
>>
I am afraid that if bad tick comes it will throw the calculations
for the range and for the average off and you wont be able
to detect your bad tick. 
<<

Good point Val. The range would be artificially large for 100 bars. It could
be set up like the following to ignore the range of the bad tick bar by
substituting the previous range value.


{ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

apply to 4-tick chart

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ}



vars:Rng(0),out(0),avrng(0);

inputs:x(100),dev(3.8);

{ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ}

if out=0 then
  rng=H-L
else
  rng=rng[1];

avrng=average(rng,x)


if avrng>0 then begin
  if rng>=dev*avrng then out=1 else out=0;
end;

if out=1 and currentbar>=100 then

plot1(H,"A");
plot2(L,"B");



<<
Also check for opening gaps.
I had to take care of those problems when  I was righting
the same routine for myself.
Val.
>>

  This seems unlikely since you are dealing with bars of more than 1 tick.
Therefore there would be as many bad ticks as the bar composes. But it
could be done using the same method by comparing range between bars.
You would have to wait for a completed bar after the bad bar to get a
signal because a gap opening could be valid.

dbs

The code then becomes this.......

{ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

apply to 4-tick chart

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ}



vars:Rng(0),out(0),avrng(0);

inputs:x(100),dev(3.8);

{ZZZZZZZZZZZZZZZZZZZZZZZZZZZZ}

if out=0 then
  rng=H-L
else
  rng=rng[1];

avrng=average(rng,x)


if avrng>0 then begin
  if rng>=dev*avrng then out=1 else out=0;
  if L[1]-H>=dev*avrng and L[1]-H[2]>=dev*avrng then out=1;
  if L-H[1]>=dev*avrng and L[2]-H[1]>=dev*avrng then out=1;
end;

if out=1 and currentbar>=100 then

plot1(H,"A");
plot2(L,"B");