TradingView
jasondhadley
Nov 1, 2016 7:21 PM

Super Smooth Moving Averages 

Description

Straight conversion of:
SuperSmoother filter © 2013 John F. Ehlers

Yellow/Green line is Super Smoothing Average, blue line is EMA(10) to give a comparison
Comments
pbagdai
supperb innovation...really nice..thanks
JustUncleL
Just letting you know it does not work at all period lengths, like if I put in 11,12, or 15 I get jagged MA plot.
sal157011
@JustUncleL, I think you are refering to the SuperSmoother when you get de jagged plot and not to the triangular moving average. The triangular moving average has a problem with the odd/even lengths but doesn't jag.
The problem with the jagged SuperSmoother is a very common error when translating scripts from Tradestation Easylanguage, and many more scripts in this library suffer from this error.
The error is that in tradestation Easylanguage when you have cos(x) the angle x must be in degrees and in PineScript in cos(x) the angle x must be in radians.
To solve the problem you must convert the x degrees to radians multiplying de x degrees by pi / 180.
Thus, the line 13 b1 = 2*a1*cos(1.414*180 / ssPeriod)
should be replaced by b1 = 2*a1*cos((3.14159/180)*(1.414*180 / ssPeriod)) and voilà.

JustUncleL
@sal157011, Yes I was referring to the SuperSmoother. I did wonder whether it should have been converted to radian. I had a similar issue when I coded another one of Ehlers Easylanguage indicators.
JustUncleL
Thanks for sharing, this is a smooth curve and gives smoother results than the HullMA particular at lengths less than 10 after that the Hull gives similar results with slightly shorter lengths. I will add to my list of tools. If you want a really slow and smooth curve try the Triangular MA (=sma((source,length),length).
JustUncleL
Sorry that should be = sma(sma(source,length),length)
sal157011
that it is not a triangular moving average
JustUncleL
That is the calculation according to the information I have on the subject. Although, I may be corrected, I am not an expert on the different MA calculations, it may be misnamed in my reference.
sal157011
@JustUncleL, I think you are right. I was used to the formula with coeficcients used by John Ehlers on his book Cybernetic Analysis for Stock and Futures but, your formula achieves the same thing.
More