OPEN-SOURCE SCRIPT

Dynamic Momentum Range Index (DMRI)

//version=5
indicator("Dynamic Momentum Range Index (DMRI)", shorttitle="DMRI", overlay=false)

// Inputs
n = input.int(14, title="Momentum Period", minval=1)
atrLength = input.int(14, title="ATR Length", minval=1)
maLength = input.int(20, title="Moving Average Length", minval=1)

// Calculations
pm = close - close[n] // Price Momentum (PM)
atr = ta.atr(atrLength) // Average True Range (ATR)
va = pm / atr // Volatility Adjustment (VA)

// Moving Average and Dynamic Range Factor (DRF)
ma = ta.sma(close, maLength)
drf = math.abs(close - ma) / atr

// Dynamic Momentum Range Index (DMRI)
dmri = va * drf

// Normalization
maxVal = ta.highest(dmri, atrLength)
minVal = ta.lowest(dmri, atrLength)
dmriNormalized = (dmri - minVal) / (maxVal - minVal) * 100

// Zones for Interpretation
bullishZone = 70
bearishZone = 30

// Plotting DMRI
plot(dmriNormalized, title="DMRI", color=color.blue, linewidth=2)
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
hline(50, "Neutral", color=color.gray)

// Background Coloring
bgcolor(dmriNormalized > bullishZone ? color.new(color.green, 90) : na, title="Bullish Zone Highlight")
bgcolor(dmriNormalized < bearishZone ? color.new(color.red, 90) : na, title="Bearish Zone Highlight")
ATRdynamicrangemarketreversalMomentum Indicator (MOM)momentumindicatoroverboughtoversoldpricemomentumTechnical AnalysistrendreversalVolatilityvolatilityadjusted

Open-source script

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer