INNER CODE UNIT · Python
alpha_arg
aticio/legitindicators · legitindicators.py:175
alpha_arg = 2 * 3.14159 / (hp_length * 1.414)
alpha1 = (math.cos(alpha_arg) + math.sin(alpha_arg) - 1) / math.cos(alpha_arg)
hpf.append(math.pow(1.0-alpha1/2.0, 2)*(data[i]-2*data[i-1]+data[i-2]) + 2*(1-alpha1)*hpf[i-1] - math.pow(1-alpha1, 2)*hpf[i-2])
ss = super_smoother(hpf, ss_length)
return ss
def super_smoother(data, length):
"""Python implementation of the Super Smoother indicator created by John Ehlers
:param data: list of price data
:type data: list
:param length: period
:type length: int
:return: Super smoothed price data
:rtype: list
"""
ssf = []