logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
StR1  
#1 Posted : Saturday, May 12, 2007 1:55:45 PM(UTC)
StR1

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/12/2007(UTC)
Posts: 1

I am trying to build an "Expert" using multiple criteria, one being the MDI (Minus Directional Movement / -DI). Since "MDI" is not in the "Indicator Builder" list, I am not able to use it.

Does anyone have the actual math code for MDI so I may save it as a new indicator that would be useable while building my "Expert"?

Thank you,

StR1

*PP  
#2 Posted : Saturday, May 12, 2007 2:50:00 PM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

StR1,

Look again, MDI is there as well as PDI and ADX. But if u really want a formula here it is:

perd:=Input("Periods -DI",2,200,20);

DMDn:= If(L<Ref(L,-1) AND H<Ref(H,-1),Ref(L,-1)-L,If(L<Ref(L,-1) AND H>Ref(H,-1),If(Ref(L,-1)-L>H-Ref(H,-1),Ref(L,-1)-L,0),0));

TR1:= Max(H-L,H-Ref(C,-1)); {day true range}
TR:=If(TR1>Ref(C,-1)-L,TR1,Ref(C,-1)-L);

AvgDMDn:=Mov(DMDn,perd,E);
AvgTR:=Mov(TR,perd,E);

DIminus:=AvgDMDn/AvgTR*100;

DIminus

Cheers

mstt  
#3 Posted : Sunday, May 13, 2007 2:21:29 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

PP

Changing three of the last four lines of your code gives a -DI result that is true to the MetaStock MDI() function.

perd:=Input("Periods -DI",2,200,20);

DMDn:= If(L<Ref(L,-1) AND H<Ref(H,-1),Ref(L,-1)-L,If(L<Ref(L,-1) AND H>Ref(H,-1),If(Ref(L,-1)-L>H-Ref(H,-1),Ref(L,-1)-L,0),0));

TR1:= Max(H-L,H-Ref(C,-1)); {day true range}

TR:=If(TR1>Ref(C,-1)-L,TR1,Ref(C,-1)-L);

AvgDMDn:=Wilders(DMDn,perd);

AvgTR:=Wilders(TR,perd);

DIminus:=Round(AvgDMDn/AvgTR*100);

DIminus;

Roy

MetaStock Tips & Tools

*PP  
#4 Posted : Sunday, May 13, 2007 3:52:44 AM(UTC)
*PP

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/1/2006(UTC)
Posts: 135
Location: Romania

msst,

i know but that was exactly what i wanted to change. As u know, i am sure of that, all indicators made by Welles Wilder and availiable in metastock use an old way to smooth the data and that because in 1970 personal computers were, well, lets say not availiiable for any pocket so i do preffer smoothing with a exponential moving average or even simple moving average. But i am sure that u are very well aware of that...

;)

mstt  
#5 Posted : Sunday, May 13, 2007 4:27:20 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

PP

Point taken.

Roy

MetaStock Tips & Tools

Flexi  
#6 Posted : Sunday, September 16, 2012 3:20:50 AM(UTC)
Flexi

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 5/27/2006(UTC)
Posts: 135

Roy,

How does ms compute the wilder smoothing? Try to do the computation on excel but the value differs from ms. Using sma for the intial value and subsequent uses wilder smoothing.
mstt  
#7 Posted : Sunday, September 16, 2012 4:36:34 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Flexi

This code duplicates the sandard metaStock Wilders Smoothing.

Code:



 {Wilders Smoothing}
Periods:=Input("Periods",1,999,10);
Data:=C; 
Rate:=1/Periods;
WildersSmoothing:=If(Cum(1)<=Periods, Mov(Data,Periods,S), PREV*(1-Rate) + Data*Rate);
WildersSmoothing;

Roy
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.