Re: ADX DMI Indicators for MT4

418
Hello Mr tools, id like to know if you can help me with a small problem, The problem that I have is that the ADX indicator that comes default in mt4 has completely different values than the default ADX indicator inside of TradingView although the period of both indicators is set to 14. One difference between the two indicators is that the default ADX indicator in MT4 only allows you to change one value in it's settings and inside of TradingView when you go inside the settings of the indicator it has two options which are ADX smoothing and DI length and they are both set to 14. I've attached several images that show the name and settings of the default adx indicator inside tradingview that id like the mt4 adx indicator values to follow. Hopefully it gives clarity to my questions/problem. My hope is that I can locate in ADX indicator for mt4 that plots the exact values as the default ADX indicator does within TradingView. I have literally gone through every single page in this specific thread, downloaded each adx indicator and installed it into mt4 and tried adjusting the settings to get it to match the values of the default ADX indicator within TradingView. I do not know why I cannot get the values to line up and be exactly the same is this something that you can help me with? Im sure u have alot more understanding to how these values are calculated than i do. thanks in advance
Attachments

Re: ADX DMI Indicators for MT4

419
kmck5147 wrote: Fri Oct 01, 2021 2:45 pm Hello Mr tools, id like to know if you can help me with a small problem, The problem that I have is that the ADX indicator that comes default in mt4 has completely different values than the default ADX indicator inside of TradingView although the period of both indicators is set to 14. One difference between the two indicators is that the default ADX indicator in MT4 only allows you to change one value in it's settings and inside of TradingView when you go inside the settings of the indicator it has two options which are ADX smoothing and DI length and they are both set to 14. I've attached several images that show the name and settings of the default adx indicator inside tradingview that id like the mt4 adx indicator values to follow. Hopefully it gives clarity to my questions/problem. My hope is that I can locate in ADX indicator for mt4 that plots the exact values as the default ADX indicator does within TradingView. I have literally gone through every single page in this specific thread, downloaded each adx indicator and installed it into mt4 and tried adjusting the settings to get it to match the values of the default ADX indicator within TradingView. I do not know why I cannot get the values to line up and be exactly the same is this something that you can help me with? Im sure u have alot more understanding to how these values are calculated than i do. thanks in advance
Could you post the code here?
These users thanked the author mrtools for the post (total 2):
Jimmy, Jedidiah

Re: ADX DMI Indicators for MT4

420
mrtools wrote: Sat Oct 02, 2021 8:17 am Could you post the code here?
Here is the code.

Code: Select all

//@version=3
study("Average Directional Index w/ DI", shorttitle="ADX+DI")
adxlen = input(14, title="ADX Smoothing")
dilen = input(14, title="DI Length")
th = input(title="threshold", type=integer, defval=20)
dirmov(len) =>
	up = change(high)
	down = -change(low)
	plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
	truerange = rma(tr, len)
	
	plus = fixnan(100 * rma(plusDM, len) / truerange)
	minus = fixnan(100 * rma(minusDM, len) / truerange)

	[plus, minus]

adx(dilen, adxlen) =>
	[plus, minus] = dirmov(dilen)
	sum = plus + minus
	adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

	
[plus, minus] = dirmov(dilen)
sig = adx(dilen, adxlen)


plot(plus, color = green, title="plusDI")
plot(minus, color = red, title="minusDI")
plot(sig, color=white, title="ADX")
hline(th, color=white, linestyle=dashed)


Who is online

Users browsing this forum: alimpe2000, Amazon [Bot], ChatGPT [Bot], Gosfraba, specialkey, thomdel, vvFish and 75 guests