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

[Metastockusers] Re: ATR - True & Reverse



PureBytes Links

Trading Reference Links

MetaStock does use Wilder's Smoothing rather than a MA, in the ATR 
calculation. Technical Analysis from A-Z explains how it is 
calculated.

Trader Joe...

--- In Metastockusers@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> 
wrote:
> Hi Jose
> 
> > Whilst coding the True/Reverse ATR indicator below, I've noticed 
that
> > MetaStock Pro v8.01 smooths ATR's erroneously.  The MS exponential
> > smoothing is based on periods*2-1.
> 
> The "periods*2-1" ratio is that used by Wilders Smoothing, the form 
of exponential moving average
> used in a number of indicators developed by Wilder.
> 
> See the following code for similarities and differences. Notice 
that Wilders Smoothing is seeded by
> a Simple Moving Average for "n" periods while the EMA is seeded on 
bar one by the value of the data
> array being smoothed. The EMA code below does not have any N/A plot 
(this can be created easily
> enough) but it is still true to the standard MetaStock EMA.
> 
> Since Wilder iss the author of the "Average True Range" indicator I 
would think that Wilders
> Smoothing is the intended form of smoothing. Of course I could be 
wrong as you have seen more than
> once in the past.
> 
>   {Exponential Moving Average}
> n:=Input("Periods",1,999,10);
> R:=2/(n+1); {ratio of new data added each bar}
> If(Cum(1)=1,C,PREV*(1-R)+C*R);
> 
>   {Wilders Smoothing}
> n:=Input("Periods",1,999,10);
> R:=1/n; {ratio of new data added each bar}
> If(Cum(1)<=n,Mov(C,n,S),PREV*(1-R)+C*R);
> 
> Roy
> 
> > For example, MetaStock's ATR(10) is the same as Mov(ATR(1),19,E).
> > If I've missed something here, I'd appreciate it if someone would
> > please correct me.
> >
> > ====================
> > ATR - True & Reverse
> > ====================
> > ---8<---------------
> >
> > { True ATR and Reverse-ATR v1.0 }
> > { ©Copyright 2004 Jose Silva }
> > { josesilva22@xxxx }
> >
> > { Reverse True Range is the the *smallest*
> >   of the following for each period:
> >   * The distance from today's High
> >     to today's Low;
> >   * The distance from yesterday's Close
> >     to today's High;
> >   * The distance from yesterday's Close
> >     to today's Low.}
> >
> > plot:=Input("[1]true ATR, [2]MS-compatible ATR, [3]Reverse 
ATR",1,3,1)
> > ;
> > pds:=Input("ATR/RATR periods",1,252,10);
> > pdsN:=Input("normalizing periods (1=none)",
> >  1,2520,1);
> >
> > x1:=ValueWhen(2,1,C);
> > ATR1:=Max(H-L,Max(Abs(x1-H),Abs(x1-L)));
> > ATRtrue:=Mov(ATR1,pds,E);
> > ATRmeta:=Mov(ATR1,pds*2-1,E);
> > rATR:=
> >  Mov(Min(H-L,Min(Abs(x1-H),Abs(x1-L))),pds,E);
> > TR:=If(plot=1,ATRtrue,If(plot=2,ATRmeta,rATR));
> > ATRnorm:=(TR-LLV(TR,pdsN))
> >  /(HHV(TR,pdsN)-LLV(TR,pdsN)+.000001)*100;
> > ATRplot:=If(pdsN<2,TR,ATRnorm);
> >
> > ATRplot
> >
> > ---8<---------------
> >
> >
> > jose '-)
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >



------------------------ 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/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
     Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

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