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

[EquisMetaStock Group] Re: Dynamic Momentum Index (DMI)



PureBytes Links

Trading Reference Links

Posted code too soon.  :)
Here it is again minus two dll syntax bugs:

========================
Dynamic Mom Index - jose
========================
---8<---------------------------

{ Jose's Dynamic Momentum Index v4.0, 0~100% }
{ Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }

{ Indicator uses Dll developed by MetaStock Forum Crew } 
{ Available at http://forum.equis.com } 

pds:=Input("avg DyMoIdx periods",3,260,21);
Stpds:=Input("Standard Deviation periods",2,260,5);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5",1,5,4);
plot:=Input("[1]Dynamic Momentum Idx, [2]dynamic periods
used",1,2,1);

x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C))));
Vt:=Stdev(x,Stpds)/Mov(Stdev(x,Stpds),10,S);
pds:=pds/(Vt+.14142);
pds:=If(pds>Cum(IsDefined(x))-13,
Cum(IsDefined(x))-13,pds);
pds:=If(pds<2,2,pds);

Up:=If(x>Ref(x,-1),x-Ref(x,-1),0);
Dw:=If(x<Ref(x,-1),Ref(x,-1)-x,0);
UpAvg:=ExtFml("ForumDll.VarMOV",Up,pds,e);
DwAvg:=ExtFml("ForumDll.VarMOV",Dw,pds,e);
DyMoIdx:=100-(100/(1+UpAvg/Max(DwAvg,.000001)));

If(plot=1,DyMoIdx,pds)

---8<---------------------------


jose '-)
http://www.metastocktools.com



--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
<josesilva22@xxxx> wrote:
> Also check out the faster dll version below - it may need debuging 
> as I don't have MetaStock with me at the moment on holidays.
> 
> ========================
> Dynamic Mom Index - jose
> ========================
> ---8<---------------------------
> 
> { Jose's Dynamic Momentum Index v4.0, 0~100% }
> { Copyright 2005 Jose Silva }
> { For personal use only }
> { http://www.metastocktools.com }
> 
> { Indicator uses Dll developed by MetaStock Forum Crew } 
> { Available at http://forum.equis.com } 
> 
> pds:=Input("avg DyMoIdx periods",3,260,21);
> Stpds:=Input("Standard Deviation periods",2,260,5);
> x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5",1,5,4);
> plot:=Input("[1]Dynamic Momentum Idx, [2]dynamic periods
> used",1,2,1);
> 
> x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C))));
> Vt:=Stdev(x,Stpds)/Mov(Stdev(x,Stpds),10,S);
> pds:=pds/(Vt+.14142);
> pds:=If(pds>Cum(IsDefined(x))-13,
> Cum(IsDefined(x))-13,pds);
> pds:=If(pds<2,2,pds);
> 
> Up:=If(x>Ref(x,-1),x-Ref(x,-1),0);
> Dw:=If(x<Ref(x,-1),Ref(x,-1)-x,0);
> UpAvg:=ExtFml("ForumDll.VarMOV",Up,pds);
> DwAvg:=ExtFml("ForumDll.VarMOV",Dw,pds);
> DyMoIdx:=100-(100/(1+UpAvg/Max(DwAvg,.000001)));
> 
> If(plot=1,DyMoIdx,pds)
> 
> ---8<---------------------------
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" 
> <josesilva22@xxxx> wrote:
> The time periods the DMI can reach is around a maximum of 30 and a
> minimum of 3.
> 
> The dynamic component of MetaStock's standard Dynamic Momentum
> Index seems to be even narrower, beginning or ending around 15
> periods from memory.
> 
> Take a look at the DMI version below - and note the two PREV 
> functions, which may explain why the MetaStock version is so
> slow.  
> Using a variable-input EMA dll will speed up processing, something 
> that is necessary if contemplating using the DMI in any
> exploration.
> 
> 
> MetaStock -> Tools -> Indicator Builder -> New
> -> Copy and paste formula below.
> 
> 
> ========================
> Dynamic Mom Index - jose
> ========================
> ---8<---------------------------
> 
> { Jose's Dynamic Momentum Index v3.1, 0~100% }
> { ?Copyright 2003-2004 Jose Silva }
> { http://www.metastocktools.com }
> 
> pds:=Input("avg DyMoIdx periods",3,252,21);
> Stpds:=
>  Input("Standard Deviation periods",2,252,5);
> x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
> plot:=Input("[1]Dynamic Momentum Idx,  [2]dynamic periods 
> used",1,2,1);
> 
> x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,
>  If(x=6,P,C)))));
> Vt:=Stdev(x,Stpds)/Mov(Stdev(x,Stpds),10,S);
> pds:=pds/(Vt+.14142);
> pds:=If(pds>Cum(IsDefined(x))-13,
>  Cum(IsDefined(x))-13,pds);
> pds:=If(pds<2,2,pds);
> 
> Up:=If(x>Ref(x,-1),x-Ref(x,-1),0);
> Dw:=If(x<Ref(x,-1),Ref(x,-1)-x,0);
> UpAvg:=Up*2/pds+PREV*(1-2/pds);
> DwAvg:=Dw*2/pds+PREV*(1-2/pds);
> DyMoIdx:=
>  100-(100/(1+UpAvg/If(DwAvg>0,DwAvg,.000001)));
> 
> If(plot=1,DyMoIdx,pds)
> 
> ---8<---------------------------
> 
> 
> jose '-)
> http://www.metastocktools.com
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxxx>
> wrote:
> An indicator I think you will enjoy.
> 
> Preston
> 
> 
> Description:
> 
> The Dynamic Momentum Index (DMI) was developed by Tushar Chande
> and Stanley Kroll. The indicator is covered in detail in their
> book The New Technical Trader.
> 
> The DMI is identical to Welles Wilder's Relative Strength Index 
> except the number of periods is variable rather than fixed. The 
> variability of the time periods used in the DMI is controlled by
> the recent volatility of prices. The more volatile the prices, the
> more sensitive the DMI is to price changes. In other words, the
> DMI will use more time periods during quiet markets, and less
> during active markets. The  time periods the DMI can reach is
> around a maximum of 30 and a minimum of 3. The volatility index
> used in controlling the time periods in the DMI is based on a
> calculation using a five period standard deviation and a ten
> period average of the standard deviation. The advantage of using a
> variable length time period when calculating the RSI is that it
> overcomes the negative effects of smoothing, which often obscure
> short-term moves.
> In this indicator the option to use a bipolar index is also 
> introduced. The formula for a bipolar index is Bipolar =( up - 
> down ) / ( up + down )
> 
> Interpretation:
> Chande recommends using the DMI much the same as the RSI. However, 
> because the DMI is more sensitive to market dynamics, it often
> leads the RSI into overbought / oversold territories by one or two
> days. 
> 
> Like the RSI, look for overbought (bearish) conditions above 70
> and oversold (bullish) conditions below 30. However, before basing
> any trade off of strict overbought/oversold levels using DMI or
> any overbought/oversold indicator, Chande recommends that you
> first qualify the trendiness of the market using indicators such
> as r-squared or CMO. If these indicators suggest a non-trending
> market, then trades based on strict overbought/oversold levels
> should produce the best results. If a trending market is
> suggested, you can use the DMI to enter trades in the direction of
> the trend.
> Formula:
> {Dynamic Momentum Index (DMI)}
> {written by Preston Umrysh}
> {This indicator uses Dll software developed by MetaStock Forum
> Crew}
> {http://forum.equis.com)}
> x:=Input("normal ouput=1 Biplolar index=2",1,2,1);
> Vt:=(Stdev(C,5)/Mov(Stdev(C,5),10,S))*10;
> Umom:=If(C>Ref(C,-1),C-Ref(C,-1),0);
> Dmom:=If(C<Ref(C,-1),Ref(C,-1)-C,0);
> UPS:= ExtFml( "ForumDll.VarSUM", Umom,Vt);
> DNS:= ExtFml( "ForumDll.VarSUM", Dmom,Vt);
> SumU:=ExtFml("ForumDll.VarMOV",UPS,Vt,e)/Vt;
> SumD:=ExtFml("ForumDll.VarMOV",DNS,Vt,e)/Vt;
> RS:=SumU/SumD;
> DMnm:=100-(100/(1+RS));
> DMIn:=(SumU-SumD)/(SumU+SumD);
> If(x=1,DMnm,DMin); {end}




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h8io0ga/M=362343.6886682.7839641.1493532/D=groups/S=1705375617:TM/Y=YAHOO/EXP=1123669539/A=2894354/R=0/SIG=11qvf79s7/*http://http://www.globalgiving.com/cb/cidi/c_darfur.html";>Help Sudanese refugees rebuild their lives through GlobalGiving</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> 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/