Hello. I wonder if anyone here implemented Ehlers REMA.

Here is a sample code on pinescript.

//@version=3 // Copyright (c) 2018-present, Alex Orekhov (everget) // Ehlers Reverse Exponential Moving Average script may be freely distributed under the MIT license. study("Ehlers Reverse Exponential Moving Average", shorttitle="EREMA") trendAlpha = input(title="Trend Alpha", type=float, defval=0.05) cycleAlpha = input(title="Cycle Alpha", type=float, defval=0.3) src = input(title="Source", type=source, defval=close) erema(src, alpha) => delta = 1 - alpha ema = 0.0 ema := alpha * src + delta * nz(ema[1]) // Compute Reverse EMA re1 = delta * ema + nz(ema[1]) re2 = pow(delta, 2) * re1 + nz(re1[1]) re3 = pow(delta, 4) * re2 + nz(re2[1]) re4 = pow(delta, 8) * re3 + nz(re3[1]) re5 = pow(delta, 16) * re4 + nz(re4[1]) re6 = pow(delta, 32) * re5 + nz(re5[1]) re7 = pow(delta, 64) * re6 + nz(re6[1]) re8 = pow(delta, 128) * re7 + nz(re7[1]) erema = ema - alpha * re8 eremaTrend = erema(src, trendAlpha) eremaTrendColor = #674ea7 eremaCycle = erema(src, cycleAlpha) eremaCycleColor = eremaCycle > 0 ? #0ebb23 : red eremaTrendPlot = plot(eremaTrend, title="Trend", linewidth=2, color=eremaTrendColor, transp=0) eremaCyclePlot = plot(eremaCycle, title="Cycle", linewidth=2, color=eremaCycleColor, transp=0) fillColor = eremaTrend >= 0 and eremaCycle >= 0 ? #0ebb23 : eremaTrend < 0 and eremaCycle < 0 ? red : color(white, 100) fill(eremaTrendPlot, eremaCyclePlot, color=fillColor, transp=80) hline(0, title="Zero Level", linestyle=dotted, color=#989898)

Gary Antonacci states that: "Zakamulin compared absolute momentum to 3 different moving average methods applied to 155 years of stock market data. He found that absolute momentum performed best and was one of only two methods that beat buy and hold with statistical significance. The other was a reverse exponential moving average."

So, it might be worth giving it a try. I'm rather new to Python and not able to adapt the code yet. But feel free to give it a try, and if no one comes up with it during the upcoming weeks, I will post my own interptretation right here.

 

Author