PureBytes Links
Trading Reference Links
|
Roy:
Thanks for your helpful reply. I anticipated that I'd end up
building a spreadsheet to truly understand this, and your information
helps to know what to look at.
If I figure out what's going on I'll post it here, for the use of
others using RealTick for trading and MetaStock for testing.
Gary
--- In Metastockusers@xxxx, "Roy Larsen" <rlarsen@xxxx> wrote:
> Gary
>
> I'm not an expert in any of the matters discussed but I have found
out a few
> things about Wilders smoothing and exponential moving averages as a
result
> of a task I undertook to create a weekly ADX for display on a daily
chart.
> Forgive me if I don't answer your questions fully or at all.
However I do
> think some of the answers will be in there somewhere if you can
bear with
> me.
>
> The first problem with the MS ADX is that it is rounded to the
nearest whole
> number, and this obviously leads to small differences when compared
to the
> ADX from other packages. There is an easy solution to this and I'm
sure I
> saw it posted today though I can't recall where. The solution (to
the
> rounding) is to use the discrete code ADX instead of the bundled
one. Then
> you can choose just what level of precision you want. I got the
following
> (now slightly modified for brevity and ease of use) formula from
the Guppy
> site some time ago. I use 2 decimal point precision but you can
adjust the
> output line to whatever you want. For the moment I am at a loss to
explain
> why there is a small discrepency between a rounded 'ADX Raw' and
the bundled
> ADX function.
>
> {ADX Raw}
> Pds:= 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,Pds)/ATR(Pds);
> 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,Pds)/ATR(Pds);
> DIDif:=Abs(DIPlus-DIMinus);
> DISum:=DIPlus+DIMinus;
> ADXRaw:=100*Wilders(DIDif/DISum,Pds);
> PREC(ADXRaw,2);
>
> > Can anyone shed some light on the difference between the ADX
> > indicator displayed in RealTick and the ADX function in MetaStock?
> > When I plot them on the identical price data in the two different
> > software packages, the results are completely different. The
> > RealTick ADX behaves as I would expect, with significant
variations
> > between higher values (> 30 or so) for trending conditions and
lower
> > values (< 30 or so) for channeling conditions. The RealTick ADX
line
> > also begins 14 days after the start of the data for a 14-period
ADX.
> > The MetaStock ADX is nearly a flat line, and begins 28 days after
the
> > start of the data (for a 14-period ADX). It looks like it's being
> > smoothed a second time.
>
> I believe the 28 bar N/A period for the MetaStock indicators relate
to the
> way that the Wilders Smoothing is calculated. I can't reall who
alluded it
> to it in a recent post but they were correct in stating that Wilders
> smoothing is really an EMA where the periods are calculated as
(Periods*2)-1
> relative to a standard EMA. This accounts for the 27 N/A bars and
the
> display starting in the 28th bar. However I have discovered that
there is
> another way to calculate Wilders smoothing that will only have 14
N/A bars.
> To follow all this it would probably help to read up
about "Exponential
> Moving Averages" in the MetaStock User Manual. The down side of
my "fix" is
> that a PREV is required to accomplish either Wilders smoothing or
an EMA.
>
> The following versions are both "seeded" on the first bar so that
there is
> no N/A period. Seeding also prevents the indicator from starting at
zero.
>
> {Exponential Moving Average}
> Period:=Input("Periods",3,99,14);
> Target:=P;
> Prcent:=2/(Period + 1);
> Ema:=If(Cum(1)=1,Target,PREV*
> (1-Prcent) + Target*Prcent);
> Ema;
>
> {Wilders Smoothing}
> Period:=Input("Periods",3,99,14);
> Target:=P;
> Prcent:=1/Period;
> Wsm:=If(Cum(1)=1,Target,PREV*
> (1-Prcent)+Target*Prcent);
> Wsm;
>
> You'll notice that the only difference between the two indicators
is the
> "Prcent" variable. This is the factor that determines the
percentage of the
> target value that is added with each new bar, and the percentage of
the of
> the previous value that is discarded.
>
> It's my belief that the MS Wilders() function is based a 'Prcent'
value of
> 2/(2*Period) - 27 period N/A, rather than 1/Period which will give
a 14
> period N/A. This argument may be somewhat tenuous but the fact is
that
> Wilders() is the only smoothing employed in the ADX, and I'm not
forgetting
> that ATR() also uses Wilders smoothing.
>
> As I said to start with I'm really not an expert on any of this so
I've
> probably created more questions than answers.
>
> Roy
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/
|