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

Re: [Metastockusers] ADX initialization



PureBytes Links

Trading Reference Links

Yarroll

> Roy: it's precisely the beginning of the chart that I'm worried about. I'm
> concerned mostly with high ADX values, and I can't test for that if ADX
> falls from the sky (like from above 90) and I can't expect this to happen
in
> trading :-

I think the issue that you're experiencing at the beginning of the chart is
different from the exploration issue I mentioned, but not entirely
unrelated.

> So are you saying I'd need 5 times nominal periods? Like to use in tester:

The System Tester will pick up identical values to those in your chart
because it uses the same amount of history as you load with each chart. The
problem I was describing occurs with explorations (or exploration based
system tests like Trade Equity) when the exploration uses less periods than
the loaded chart

> cross( C, Mov(C,5,S))  {whatever}
> and
> ( ADX(30)>Ref(ADX(30,-1)  and cum(1)>150 )?

No. I don't think this is any solution to your problem

> 150 bars for ADX(30) this seems like a lot. Are you sure? I'm not at all
> familiar with the math behind Wilders smoothing. Does it lag so much?

Just focussing on the problem I described for a moment, you can test for the
situation I warned about. Set up a test exploration using "minimum" periods
to return ADX(30). Then check those values on your charts. I'm sure you'll
find significant discrepencies. Now run the same exploration and specify 150
periods. You're unlikely to find any differences. The MS canned ADX() is
rounded to whole numbers so but some indicators returning 4 decimal places
really do need 5 times the amount of data to get 4 decimal digit accuracy
because of the nature of the EMA (or Widers) used internally.

> There is a similar problem with Intraday Momentum Index, it too starts
very
> high (from 100, on a 0-100 scale). For IMI I always used
> and cum(1)>{3 x IMI lookback)
> for example, IMI(50) and cum(1)>150,  just to be on the safe side. After
> 3xlookback IMI seems to straiten out.

This is an indicator that I am not familiar with so can't comment at all.

Getting back to the ADX(), you probably need to look at how it's constructed
to begin to understand some of the issues. Below is an MS coded ADX which
allows you to examine the inner workings. I've also included the code for
Wilders Smoothing and EMA and you'll notice the biggest difference is the
"R" variable which is used to decide what ratio of new data to add. The
important thing to remember with an EMA is that old data is not completely
discarded as happens in an SMA. Only a percentage of old data is discarded
so previous data well outside the "periods" range can still have an effect
on the EMA value.

Moving on to the ADX proper, take a look at the PlusDM, MinusDM, DIPlus and
DIMinus construction. The vagaries of your data can mean that these signals
are hugely different on the early bars of a chart, particularly PlusDM and
MinusDM. Also notice that DIPlus and DIMinus not only use Wilders to smooth
these signals but they then divide by ATR(periods). Well guess how ATR is
constructed. More of the same INCLUDING another dose of Wilders Smoothing
AND some summing of price action that once again can introduce a very
unbalanced signal until the smoothing kicks in.

I only have weekly ATR() (for daily charts) and that's a little too complex
to illustrate the point. However, the point is that the nature of the way
data is calculated by ATR and ADX, and to some extent the way smoothing is
applied to that data, the initial plots from these functions can easily be
at either extreme of the scale.

About the only "remedy" that I think you could apply would be to try and
"seed" the various Wilders Smoothing functions with a data-neutral value.
This is impractical because of the number of PREV's you would introduce for
one thing.  Secondly, it would possibly cause worse distortions just when
you didn't need it. Best to understand what you have and accept it or move
to other indicators that are not similarly afflicted.

Roy

  {ADX Raw}
Periods:=Input("Enter time periods",1,100,14);
PlusDM:=If(H>Ref(H,-1) AND
L>=Ref(L,-1),H-Ref(H,-1),
If(H>Ref(H,-1) AND L<Ref(L,-1)
AND H-Ref(H,-1)>Ref(L,-1)-L,H-Ref(H,-1),0));
DIPlus:=100*Wilders(PlusDM,Periods)/ATR(Periods);
MinusDM:=If(L<Ref(L,-1) AND
H<=Ref(H,-1),Ref(L,-1)-L,
If(H>Ref(H,-1) AND L<Ref(L,-1)
AND H-Ref(H,-1)<Ref(L,-1)-L,Ref(L,-1)-L,0));
DIMinus:=100*Wilders(MinusDM,Periods)/ATR(Periods);
DIDif:=Abs(DIPlus - DIMinus);
DISum:=DIPlus + DIMinus;
100*Wilders(DIDif/DISum,Periods);

  {Wilders Smoothing}
A:=Input("Periods",1,99,14);
B:=P; {target data array - usually CLOSE}
R:=1/A;
M:=If(Cum(1)<=A,Mov(B,A,S),PREV*(1-R)+B*R); M;

  {Exponential Moving Average}
A:=Input("Periods",1,99,14);
B:=P; {target data array - usually CLOSE}
R:=2/(A+1);
M:=If(Cum(1)=1,B,PREV*(1-R)+B*R); M;



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/