New York, New York
Posts: 1 since Mar 2012
Thanks Given: 0
Thanks Received: 0
|
Here's the EasyLanguage code for John Ehlers' 4 Pole Gaussian Filter:
Four Poles: f = alpha^4g + 4(1-alpha)f[1] - 6(1-alpha)^2f[2] + 4(1-alpha)^3f[3] - (1-alpha)^4f[4]
g=price and where alpha = =-Beta+SQR(Beta^2 +2*Beta), and Where Beta = (1 – cos(symbol)) / (1.414^2/N – 1), where symbol = 2pi/P, N = # of poles in the filter, in this case 4, and P = Period, i.e 15
Here's what I came up with: (I just solved what 2pi b/c I don't know the function to use for pi, and I solved what 1.414^(2/N); N=4(4 Pole), so equals 1.18911732 minus 1 from the EasyLanguage formula above. The problem I'm experiencing is that I get a legit plot for 15 period, but once I adjust the plot, i.e move to 20 period, it goes insane, rendering it useless for higher than 20 period. Reason? Any suggestion would be awesome.
input period = 15;
input paintbars = {"Yes", default "No"};
def price = vwap;
def symbol = (6.28318531) / period;
def beta = (1 – Cos(symbol)) / (0.18911732);
def alpha = -beta + Sqr(power(beta,2) + (2 * beta));
rec Gaussian = (Power(alpha, 4)) * price + (4 * (1 - alpha)) * Gaussian[1] - 6 * Power(1 - alpha, 2) * Gaussian[2] + 4 * Power(1 - alpha, 3) * Gaussian[3] - Power(1 - alpha, 4) * Gaussian[4];
plot GF= Gaussian;
|