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

[EquisMetaStock Group] Re: Directional movement index in metastock



PureBytes Links

Trading Reference Links

Alex,

Its been a problem that has existed for quite a while.

http://finance.groups.yahoo.com/group/equismetastock/message/27047

In order to get a formula which contains inputs to work you must change them to constants.

For instance:

pds:=Input("ADX periods",1,100,14);

becomes simply

pds:=14;


The problem you will run into is the multiple plots. In the formula that you have chosen there is a 3 part decision tree...plot, final and window. You will need to decide what you want to use.



Hope this helps,


Preston






--- In equismetastock@xxxxxxxxxxxxxxx, "alex_onea" <alex_onea@xxx> wrote:
>
> Hello everybody, 
> 
> I discovered that the Metastock 10.1 has troubles in calculating correctly the Directional Movement Index (ADX, +DI and -DI). The internal formulas pdi(x), mdi(x) as well as dx(x) do not give the correct values. I found the formulas at www.metastocktools.com, as you can see below. The thing is that the formulas are intended for buiding an indicator. My wish is to use the DMI formulas for an exploration. 
> Unfortunately, it did not work to export the formulas to an exploration (due to the input commands). 
> 
> Can you give some piece of advice on this issue? 
> Thanks in advance. 
> 
> Alex 
> 
> 
> MetaStock -> Tools -> Indicator Builder -> New
> -> copy & paste complete formulae between "---8<---" lines.
> 
> ===================
> ADX/PDI/MDI -  True
> ===================
> 
> ---8<------------------------------------
> 
> { True ADX/PDI/MDI v2.0 Incorporating automatic Support/Resistance.
> 
>  MetaStock's native ADX plots erratic ADX values as periods are increased. e.g., compare this formula (50pds) to MS's ADX(50).
> 
>  Copyright © 2003-2008 Jose Silva. For personal use only.
>  http://www.metastocktools.com }
> 
> { User inputs }
> pds:=Input("ADX periods",1,100,14);
> plot:=Input("plot:  [1]ADX,  [2]PDI,  [3]MDI,  [4]All",1,4,1);
> 
> { Variables }
> Lo1:=Ref(L,-1);
> Hi1:=Ref(H,-1);
> 
> { Plus Directional Movement (PDI) }
> condUp:=H>Hi1 AND L>=Lo1
>  OR H>Hi1 AND L<Lo1 AND H-Hi1>Lo1-L;
> PlusDM:=Wilders(condUp*(H-Hi1),pds)/ATR(pds)
>  *100;
> 
> { Minus Directional Movement (MDI) }
> condDw:=H<=Hi1 AND L<Lo1
>  OR H>Hi1 AND L<Lo1 AND H-Hi1<Lo1-L;
> MinusDM:=Wilders(condDw*(Lo1-L),pds)/ATR(pds)
>  *100;
> 
> { True Average Directional Movement (ADX) }
> DMdiff:=Abs(PlusDM-MinusDM);
> DMsum:=Max(PlusDM+MinusDM,.000001);
> ADXtrue:=100*Wilders(DMdiff/DMsum,pds);
> 
> { Final plot }
> x:=If(plot=2,PlusDM,If(plot=3,MinusDM,ADXtrue));
> 
> { Automatic OverBought/Sold historical levels }
> avg:=Cum(x)/Cum(IsDefined(x));
> pk:=Ref(x,-1)=HHV(x,3) AND Ref(x,-1)>avg;
> pk1:=ValueWhen(1,pk,Ref(x,-1))*pk;
> oBought:=Cum(pk1)/Cum(pk);
> tr:=Ref(x,-1)=LLV(x,3) AND Ref(x,-1)<avg;
> tr1:=ValueWhen(1,tr,Ref(x,-1))*tr;
> oSold:=Cum(tr1)/Cum(tr);
> 
> { Plot in own window }
> oBought;oSold;
> If(plot=4,ADXtrue,x);
> If(plot=4,PlusDM,x);
> If(plot=4,MinusDM,x)
> 
> ---8<------------------------------------
>




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

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

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

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