Anyone using information or codes on these pages does so at their own risk - no guarantees of stability or profitability are claimed. These codes are all for testing purposes only.
{3 Pole Butterworth Filter - //// From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers //// code compiled by dn
} // plot on a subgraph separate from the price region.
Input: Price((H+L)/2), Period(15);
Var: a1(0), b1(0), c1(0), coef1(0), coef2(0), coef3(0), coef4(0), Butter(0);
a1=expvalue(-3.14159/Period);
b1=2*a1*Cosine(1.738*180/Period);
c1=a1*a1;
coef2=b1+c1;
coef3=-(c1+b1*c1);
coef4=c1*c1;
coef1=(1-b1+c1)*(1-c1)/8;
Butter = coef1*(Price+3*Price[1]+3*Price[2]+Price[3])+coef2*Butter[1]+coef3*Butter[2]+coef4*Butter[3];
If CurrentBar<4 then Butter=Price;
Plot1(Butter,"Butter",blue);