RicardoSantos

[RS]NDBMFB DMI Index V0

DMI
189 0 32
dmi
Request for NDBMFB
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]NDBMFB DMI Index V0", shorttitle="[RS]NDBMFB.DMI.Index V0", overlay=false)
adxlen = input(4, title="ADX Smoothing")
dilen = input(8, title="DI Length")
//  ||---Functions by: Greeny
dirmov(len) =>
	up = change(high)
	down = -change(low)
	truerange = rma(tr, len)
	plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
	minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, 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)
	[adx, plus, minus]

[sig, up, down] = adx(dilen, adxlen)

//  ||---------------------------------------------------------------------------
brackit(x, v1, v2)=> x >= v1 and x < v2
cond1 = brackit(sig, 0, 20) ? #e7edee :
        brackit(sig, 20, 30) ? #e0e8ea :
        brackit(sig, 30, 35) ? #dde6e8 :
        brackit(sig, 35, 40) ? #c6cfd0 :
        brackit(sig, 40, 45) ? #b0b8b9 :
        brackit(sig, 45, 50) ? #9aa1a2 :
        brackit(sig, 50, 55) ? #848a8b :
        brackit(sig, 55, 60) ? #6e7374 :
        brackit(sig, 60, 65) ? #585c5c :
        brackit(sig, 65, 70) ? #424545 :
        brackit(sig, 70, 80) ? #2c2e2e :
        brackit(sig, 80, 100) ? #161717 : na
cond2 = brackit(sig, 20, 30) ? #424545 :
        brackit(sig, 45, 55) ? #2c2e2e :
        brackit(sig, 70, 80) ? #161717 : na

showCondition1 = input(true)
showCondition2 = input(true)

plot(not showCondition1 ? na : sig, color=cond1, style=columns, title="ADX Columns1")
plot(not showCondition2 ? na : sig, color=cond2, style=columns, title="ADX Columns2")
plot(sig, color=black, title="ADX")
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out