TradingView
nemozny
14 נוב׳ 2016 20:33

FRAMA (Ehlers true modified calculation) 

FedEx CorporationNYSE

תיאור

Credit goes to Shizaru for the original calculation. I made just a few fixes, so that the calculation is really that of Ehlers.
Fixed H2 and L2 period, fixed w natural logarithm

הערות שחרור

הערות שחרור

fixed input(close) that was ignored in the last version

הערות שחרור

Converted to v5.
Replaced the awkward log w by -4.6, as in the original white paper.
Replaced the dimen by variable assignment, to make the calculation a bit more clear.
תגובות
sunk_manitu
thank you for this version. One comment though, log in pine script stands for "ln"( natural logarithm). log10 stands for real "log". That's really counter intuitive at first glance
jlseagull
Thank you for this nemozny. I am trying to convert it into Python for backtesting an algo strategy but I am confused by the calculation of OUT on line 31. How can OUT = its previous self out[1]? I do not understand how OUT can use itself in its own calculation before it has been defined. I guess I must be missing something as your indicator works perfectly. Is there a different way to write that last calculation of out? Perhaps I could understand it better if you could break it into a few more lines. Would really appreciate it if you could! thank you
jlseagull
@jlseagull, sorry I mistyped - what I mean is how can the calculation for out call out[1] in its own definition?
nemozny
@jlseagull, answering only 5 years later, but that syntax is a new variable syntax - assignment works with past values in the variable. That is why you need to check against null "nz()", because the variable is empty in the first run. All subsequent runs it will hold the value of the previous assignment.
markfnovak
I'm not a TradingView user, just someone taking a close look at this. I believe there's a bug in line 25 and it should be:
dimen = iff(N1>0 and N2>0 and N3>0, dimen1,nz(dimen[1]))

This is Ehler's original EasyLanguage code:
If N1 > 0 and N2 > 0 and N3 > 0 then Dimen = (Log(N1 + N2) - Log(N3)) / Log(2);

If N1, N2 and N3 are not all greater than 0, then Dimen doesn't change. The correction I included above accomplishes that.
markfnovak
@markfnovak, Rats... I made a mistake. Here's the proper correction:
dimen = iff(N1>0 and N2>0 and N3>0, dimen1,nz(dimen[1]))
Note that the final dimen does not appear correct here. It's supposed to be dimen left-bracket 1 right-bracket. Which is not as it appears here.
nemozny
@markfnovak, I think the code is correct. First of all, Ehlers' "dimen" variable is broken down into dimen1 and dimen here.
The code (log(N1+N2)-log(N3))/log(2) is called "dimen" by Ehlers, but "dimen1" here.
Secondly Ehlers updates "dimen" only if N1>0 and N2>0 and N3>0, so in other cases the variable should hold its previous/last value.
In other words "dimen" here, not by Ehlers, should be equal to dimen1 if N1>0, etc, and to dimen1[1] (nz(dimen1[1])) in all other cases.
Maybe it could have been improved with a variable assignment, for clarity.
AlexTail
Great work ! Somebody have a version for mt5 ? i whant to test my strategy on small tf , becasue in tv i can'n do it with short data on them.
Steporto
Hello, this indicator repaint?
עוד