Hello, from the last video of better system trader I discovered this new indicator from John Ehlers
He gave the code in Easylanguage that you can find here
http://downloads.bettersystemtrader.com/files/ForwardReverseEMA.txt
{
Forward / Reverse EMA
(c) 2017 John F. Ehlers
}
Inputs:
AA(.1);
Vars:
CC(.9),
RE1(0),
RE2(0),
RE3(0),
RE4(0),
RE5(0),
RE6(0),
RE7(0),
RE8(0),
EMA(0),
Signal(0);
CC = 1 – AA;
EMA = AA*Close + CC*EMA[1];
RE1 = CC*EMA + EMA[1];
RE2 = Power(CC, 2)*RE1 + RE1[1];
RE3 = Power(CC, 4)*RE2 + RE2[1];
RE4 = Power(CC, 8)*RE3 + RE3[1];
RE5 = Power(CC, 16)*RE4 + RE4[1];
RE6 = Power(CC, 32)*RE5 + RE5[1];
RE7 = Power(CC, 64)*RE6 + RE6[1];
RE8 = Power(CC, 128)*RE7 + RE7[1];
Signal = EMA – AA*RE8;
Plot1(Signal);
Plot2(0);
I translated like this for prt, can you please tell me if it is ok?
AA= 0.1
CC = 1 - AA
if barindex > 1 then
EMA = AA*Close + CC*EMA[1]
RE1 = CC*EMA + EMA[1]
RE2 = EXP(2*LOG(CC))*RE1 + RE1[1]
RE3 = EXP(4*LOG(CC))*RE2 + RE2[1]
RE4 = EXP(8*LOG(CC))*RE3 + RE3[1]
RE5 = EXP(16*LOG(CC))*RE4 + RE4[1]
RE6 = EXP(32*LOG(CC))*RE5 + RE5[1]
RE7 = EXP(64*LOG(CC))*RE6 + RE6[1]
RE8 = EXP(128*LOG(CC))*RE7 + RE7[1]
Signal = EMA - AA*RE8
endif
return Signal
Your code is correct to me. You should post it into the library. Haven’t heard of this new John Ehlers’ formula before your post, thank you.
Thank you Nicolas, only concern is that is not really an oscilator as is not bounded between 2 values. I am a bit puzzled..
Just like an MACD, who cares? 😉 There is a “zero” level, but I understand your concern .. how to use it effectively? Maybe the answers are in the Ehlers’ interview?
in the interview he just said to use it as a mean reverting tool, without further specification. He is postponing the explanation to the people attending hismaster class understandably 🙂
Ok, so let’s use STANDARD DEVIATION like in these indicators, it would complete the analysis because as you stated this indicator is not bounded and doesn’t have any overbought/oversold areas:
https://www.prorealcode.com/prorealtime-indicators/dynamic-zone-stoch-rsi/
https://www.prorealcode.com/prorealtime-indicators/tti-atr-extreme/
etc. Whatever examples using deviation of a normal distribution around a dynamic mean.
ALEModerator
Master
AA= 0.1
CC = 1 - AA
if barindex > 1 then
EMA = AA*Close + CC*EMA[1]
RE1 = CC*EMA + EMA[1]
RE2 = EXP(2*LOG(CC))*RE1 + RE1[1]
RE3 = EXP(4*LOG(CC))*RE2 + RE2[1]
RE4 = EXP(8*LOG(CC))*RE3 + RE3[1]
RE5 = EXP(16*LOG(CC))*RE4 + RE4[1]
RE6 = EXP(32*LOG(CC))*RE5 + RE5[1]
RE7 = EXP(64*LOG(CC))*RE6 + RE6[1]
RE8 = EXP(128*LOG(CC))*RE7 + RE7[1]
result = EMA - AA*RE8
endif
r = 50+(100-(result*10000))*2
g = 50+(100+(result*10000))*2
RETURN result COLOURED(r,g,50)style(histogram) as "result", 0 as "0"
Nice colours!
Hi, thanks, I didn’t know this new indicator from Ehlers
For fun, we see it’s a “suite” and I tried to replace the re2…re8 by an instruction for /next who will me more adjustable
I don’t know why this suite doesn’t work, if someone as an idea
// variable val=5
AA= 0.1
CC = 1 - AA
if barindex > 11 then
EMA = AA*close + CC*EMA[1]
RE1 = CC*EMA + EMA[1]
once result=0
for n=1 to val
m=1
for nn=1 to val
m=2*m
next
coef=EXP(2*m*LOG(CC))
RE1 = coef*RE1[n] + RE1[n+1]
next
result = EMA - AA*RE1
endif
RETURN result
Seems to work fine for me Zilliq, what’s the problem please?
@Francesco78
Did you manage to get something new with the OB/OS dynamic areas?
@ALE
I don’t see any “nice colours”? 🙂
Hi Nicolas,
On my graph if you compare this code and the one of reverse EMA it isn’t the same thing with a variable=4
I don’t see where is the problem (Just for fun..)
Zilliq
I think the problem is that RE1 to RE8 are variables that must be set because they compute each one separately and you can’t create them dynamically like the way you did. It would be possible with arrays support though.. But I could be wrong, this is quick thought.
hello everyone,
@Nicoas, yes I did try some combination, I just wanted to test if it is usable for at least 1 strategy.
Give me a couple of days and hopefully I will have something.
cheers
Nice! I asked you because your post is still in the pending list for the library, we will change it accordingly to your new version 🙂