Regularized Momentum

Category: Indicators By: Nicolas Created: December 18, 2017, 3:40 PM
December 18, 2017, 3:40 PM
Indicators
12 Comments

The Regularized Momentum indicator is a classic momentum calculation made with a Regularized Exponential Moving Average (or Regularized EMA) of Heikin Ashi median price (Heikin Ashi High + Heikin Ashi Low) / 2.

It returns a smoothed momentum, and instead of using the 0 line to trigger trend reversals, the indicator has ‘floating levels’ made with recent highest highs and lowest lows of the main oscillator.

The ‘Length’ and ‘Lambda’ settings are adjustable, these parameters smooth more or less the curve.

//PRC_Regularized Momentum | indicator
//18.12.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//Converted from MT4 indicator (mladen)

// --- settings
//Length6=14
//Lambda=7
//MinMaxPeriod=15
//LevelUp=90
//LevelDown=10
// --- end of settings

IF BarIndex=0 THEN
 xClose = (open+high+low+close)/4
 xOpen = open
 xHigh = high
 xLow = low
ELSE
 xClose = (open+high+low+close)/4
 xOpen = (xOpen[1]+xClose[1])/2
 xHigh = Max(max(high, xOpen), xClose)
 xLow = Min(min(Low, xOpen), xClose)
endif

data = (xHigh+xLow)/2

once fctrema6=data
alpha6  = 2.0/(1.0+Length6)
regf1  = (1.0+Lambda*2.0)
regf2  = (1.0+Lambda)

if barindex>length6 then
 fctrema6 = (regf1*fctrema6[1]+alpha6*(data-fctrema6[1])-Lambda*fctrema6[2])/regf2
 mom6 = (fctrema6-fctrema6[1])/fctrema6
endif

r=50
g=205
b=50
if mom6<mom6[1] then
 r=255
 g=0
 b=0
endif

//floating levels
flLookBack      = MinMaxPeriod // Floating levels lookback period
flLevelUp       = LevelUp // Floating levels up level %
flLevelDown     = LevelDown // Floating levels down level %
mini   = lowest[flLookBack](mom6)
maxi   = highest[flLookBack](mom6)
rrange = maxi-mini
flu    = mini+flLevelUp*rrange/100.0
fld    = mini+flLevelDown*rrange/100.0
flm    = mini+0.5*rrange


return mom6 coloured(r,g,b) style(line,3), flu coloured(100,100,100) STYLE(line,1) as "upper level", fld coloured(100,100,100) STYLE(line,1) as "lower level", flm coloured(100,100,100) STYLE(dottedline,1) as "median level"

 

Download
Filename: PRC_Regularized-Momentum.itf
Downloads: 927
Download
Filename: regularized-momentum.png
Downloads: 203
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...