i.trader

Directional Movement Index super改

601 views
50
DMI with ADX (-R)
オープンソーススクリプト

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

チャートでこのスクリプトを利用したいですか?
study(title="Directional Movement Index & ADX(-R)", shorttitle="DMI&ADX(-R)")
len = input(14, minval=1, title="DI Length")
lensig = input(14, title="ADX Smoothing", minval=1, maxval=50)
avg = input(14, minval=1, title="ADX-R")
SrE=input(false,title="ADX-RはEMAで計算")

up = change(high)
down = -change(low)
trur = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
adx_r = SrE==true?ema(adx,avg):sma(adx,avg)

plot(plus, color=green, title="+DI")
plot(minus, color=red, title="-DI")
plot(adx, color=blue, title="ADX",style=columns,transp=80)
plot(adx_r,color=black, title="ADX-R",style=columns,transp=80)
hline(30,linestyle=solid,color=black)