NexusFi: Find Your Edge


Home Menu

 





[ASK] CUSTOM DMI indi from Metastock >too> Tradestation/Multicharts


Discussion in MultiCharts

Updated
    1. trending_up 3,372 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
jacoGreeff
Cape Town
 
Posts: 6 since Mar 2012
Thanks Given: 4
Thanks Received: 0

Hi guys and gals I need to convert this DMI Metastock indicator to Multicharts.

I tried, but cant get the loop right that needs to take the place of the Sum function as in Metastock!!

Hope anyone can help me!!!! Thanx a trillioN!!

The metastock indicator:
N:= 14;
TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 & HD>LD,HD,0),N); //here lies the problem to get these 2 lines to tradestation
DMM:= SUM(IF(LD>0 & LD>HD,LD,0),N);
PDI:= DMP*100/TR;
MDI:= DMM*100/TR;
ADX:= MA(ABS(MDI-PDI)/(MDI+PDI)*100,N);


The build in DMI function in multicharts does not produce the same results as the above indicator I used in my system in Metastock.

Here is what I got so far as to the conversion to Multicharts, but cant get the same data produced with this as in Metastock:

i.e. this is the function I call into my system to calculate the DMI levels::

Inputs:
PriceH( numericseries ),
PriceL( numericseries ),
PriceC( numericseries ),
Len( numericsimple ),
cDMIPlus( numericref ),
cDMIMinus( numericref ),
cADX(numericref);

variables: TR (0),HD(0), LD(0), DMP(0),DMM(0), PDI(0), MDI (0);

//////////////////-----1------//////////////////
for Value1 = 0 to 13 begin

TR = Sum (maxlist(maxlist(PriceH[Value1]-PriceL[Value1], AbsValue(PriceH[Value1]-PriceC[Value1 +1])),
AbsValue(PriceL[Value1]-PriceC[Value1 +1])),Len);

end;


/////////////////------2------//////////////////
for Value1 = 0 to Len -1
begin

HD = PriceH - PriceH[1];
LD = PriceL[1] - PriceL;

if HD>0 and HD>LD then begin
DMP = DMP + HD;
end
else begin
DMP = DMP + 0;
end;

if LD>0 and LD>HD then begin
DMM = DMM + LD;
end
else begin
DMM = DMM+ 0;
end;
end;
///////////////-------3-----//////////////////
cDMIPlus = DMP*100/TR;
cDMIMinus = DMM*100/TR;
cADX = Average(AbsValue(cDMIMinus-cDMIPlus)/(cDMIMinus+cDMIPlus)*100,Len);
MyADX = 1;

Hope you can assist me on this have really been struggeling to get this code to work and give similar result as in metastock, but in multicharts!

I also looked at all the Multicharts DMI functions and infdicators, but can't seem to find any help there.


Reply With Quote

 
  #2 (permalink)
 SPMC 
GER
 
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213

Only took a fast look at it, but you set DMP and DMM to 0 on the second loops. In the MS code it only adds 0 to the sum and doesnt set it to 0.

Maybe these changes helps.

 
Code
if HD>0 and HD>LD then begin
DMP = DMP + HD;
end
else begin
DMP = DMP+ 0;
end;

if LD>0 and LD>HD then begin
DMM = DMM + LD;
end
else begin
DMM = DMM+0;
end;
end;


Reply With Quote
Thanked by:
  #3 (permalink)
jacoGreeff
Cape Town
 
Posts: 6 since Mar 2012
Thanks Given: 4
Thanks Received: 0



SPMC View Post
Only took a fast look at it, but you set DMP and DMM to 0 on the second loops. In the MS code it only adds 0 to the sum and doesnt set it to 0.

Maybe these changes helps.

 
Code
if HD>0 and HD>LD then begin
DMP = DMP + HD;
end
else begin
DMP = DMP+ 0;
end;

if LD>0 and LD>HD then begin
DMM = DMM + LD;
end
else begin
DMM = DMM+0;
end;
end;

Thanx for the help that was one of the problems, seems that this part also doesn't work:

for Value1 = 0 to 13 begin

TR = Sum (maxlist(maxlist(High[Value1]-Low[Value1], AbsValue(High[Value1]-Close[Value1 +1])),
AbsValue(Low[Value1]-Close[Value1 +1])),14);

end;


Reply With Quote




Last Updated on June 27, 2012


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts