An indicator used in technical analysis that determines the overbought and oversold conditions of a particular asset. This indicator is very similar to the Relative Strength Index (RSI). The main difference between the two is that the RSI uses a fixed number of time periods (usually 14), while the Dynamic Momentum Index uses different time periods as volatility changes.
This indicator is interpreted in the same manner as the RSI where the readings below 30 are deemed to be oversold and more than 70 levels are deemed to be overbought. The number of time periods used in the dynamic momentum index decreases as the volatility of the underlying asset increases, making this indicator more sensitive to price changes than the RSI. This version has an additional smoothing in an RSX usage form for calculating the original RSI pitch. It has been added to make it a little more readable. The DMI Chande is less smooth than this original version and can raise more false signals. Using the RSX instead of RSI not add any lag at all, so we can say that using an RSX instead of RSI could be classified as “1% improvement” rule – which is sure it not be worse than the original Chande’s DMI.
(description found on internet). Indicator translated from Metatrader5 version by a request in forum.
Settings explanation:
_ MAStdDevMode : moving average type for smoothing the ATR value used to get the volatility of the current instrument
_ DmiLowerLimit & DmiUpperLimit : bounds for DMI periods (DMI calculated period can’t be less or more than these 2 limits)
//PRC_DMI of RSX | indicator
//31.01.18
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT5 code
//https://www.prorealcode.com/topic/tushar-chandes-dmi-conversion-code-mq5-to-prorealtime/
// --- settings
StdDevPeriod = 5 // Period of Standard Deviation
MAStdDevPeriod = 8 // Period of smoothing
MAStdDevMode = 0 // Mode of smoothing MA
DMIPeriod = 15 // Dynamic Momentum Index Period
DmiLowerLimit = 10 // Dynamic Periods Lower Bound
DmiUpperLimit = 50 // Dynamic Periods Upper Bound
LevelUp = 60 // Lower level
LevelDown = 40 // Upper level
// --- end of settings
if barindex>DMIperiod then
SD = STD[StdDevPeriod](customclose)
ASD = Average[MAStdDevPeriod,MAStdDevMode](SD)
RSIterm = max(1,ROUND(DMIPeriod / (SD/ASD)))
RSIterm = Max(Min(RSIterm,DmiUpperLimit),DmiLowerLimit)
//RSI calculation
plus = summation[max(1,round(RSIterm))](customclose-customclose[1]>0)
minus = summation[max(1,round(RSIterm))](customclose-customclose[1]<0)
//plus
pow = 1
per = RSIterm
if barindex>per then
beta = 0.45*(per-1)/(0.45*(per-1)+2)
if pow=1 then
alpha = beta
elsif pow=2 then
alpha = beta*beta
elsif pow=3 then
alpha = beta*beta*beta
elsif pow=4 then
alpha = beta*beta*beta*beta
elsif pow=5 then
alpha = beta*beta*beta*beta*beta
else
alpha = beta
endif
tmp0 = (1-alpha)*plus + alpha*tmp0[1]
tmp1 = (plus - tmp0[0])*(1-beta) + beta*tmp1[1]
tmp2 = tmp0[0] + tmp1[0]
tmp3 = (tmp2[0] - tmp4[1])*((1-alpha)*(1-alpha)) + (alpha*alpha)*tmp3[1]
tmp4 = tmp4[1] + tmp3[0]
avgplus = tmp4
ftmp0 = (1-alpha)*minus + alpha*ftmp0[1]
ftmp1 = (minus - ftmp0[0])*(1-beta) + beta*ftmp1[1]
ftmp2 = ftmp0[0] + ftmp1[0]
ftmp3 = (ftmp2[0] - ftmp4[1])*((1-alpha)*(1-alpha)) + (alpha*alpha)*ftmp3[1]
ftmp4 = ftmp4[1] + ftmp3[0]
avgminus = ftmp4
endif
RS = avgplus/avgminus
DMIRSX = 100 - 100 / ( 1 + RS )
r=100
g=100
b=100
if DMIRSX>LevelUp then
r=0
g=255
b=0
elsif DMIRSX<LevelDown then
r=255
g=185
b=15
endif
endif
return DMIRSX coloured(r,g,b) style(line,3) as "Dynamic Momentum Index", levelup coloured(100,100,100) style(dottedline) as "level up", leveldown coloured(100,100,100) style(dottedline) as "level down"