Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 92 times Was thanked: 155 time(s) in 150 post(s)
|
John Ehler's article, “The Super Passband Filter”, presented his indicator, the Passband filter and suggested a ways to trade it. The indicator formula listed below uses prompts to allow you to set whatever time periods are desire for the Passband filter. The buy and sell signal formula have set those time periods are variables on the first two lines. If you wish to use different time periods, you must change those two lines in all four formulas are the signals will not align. Indicator: Passband Filter
Code:p1:= Input("short time periods", 1, 100, 40);
p2:= Input("long time periods", 2, 200, 60);
a1:= 5/p1;
a2:= 5/p2;
PB:= (a1-a2)*C + (a2*(1-a1)-a1*(1-a2))*Ref(C,-1) + ((1-a1) + (1-a2))*PREV - (1-a1)*(1-a2)*Ref(PREV,-1);
RMSa:= Sum( pb*pb, 50);
RMS:= Sqrt(RMSa/50);
pb;
0;
RMS;
-RMS
Trading Signals: Enter Long:
Code:p1:= 40;
p2:= 60;
a1:= 5/p1;
a2:= 5/p2;
PB:= (a1-a2)*C + (a2*(1-a1)-a1*(1-a2))*Ref(C,-1) + ((1-a1) + (1-a2))*PREV - (1-a1)*(1-a2)*Ref(PREV,-1);
RMSa:= Sum( pb*pb, 50);
RMS:= Sqrt(RMSa/50);
el:= Cross(pb,-RMS);
xl:= pb < Ref(pb, -1);
trade:= If(el, 1, If(xl, 0, PREV));
Cross(trade, 0.5)
Exit Long:
Code:p1:= 40;
p2:= 60;
a1:= 5/p1;
a2:= 5/p2;
PB:= (a1-a2)*C + (a2*(1-a1)-a1*(1-a2))*Ref(C,-1) + ((1-a1) + (1-a2))*PREV - (1-a1)*(1-a2)*Ref(PREV,-1);
RMSa:= Sum( pb*pb, 50);
RMS:= Sqrt(RMSa/50);
el:= Cross(pb,-RMS);
xl:= pb < Ref(pb, -1);
trade:= If(el, 1, If(xl, 0, PREV));
Cross(0.5,trade)
Enter Short:
Code:p1:= 40;
p2:= 60;
a1:= 5/p1;
a2:= 5/p2;
PB:= (a1-a2)*C + (a2*(1-a1)-a1*(1-a2))*Ref(C,-1) + ((1-a1) + (1-a2))*PREV - (1-a1)*(1-a2)*Ref(PREV,-1);
RMSa:= Sum( pb*pb, 50);
RMS:= Sqrt(RMSa/50);
es:= Cross(RMS,pb);
xs:= pb > Ref(pb, -1);
trade:= If(es, 1, If(xs, 0, PREV));
Cross(trade, 0.5)
Exit Short:
Code:p1:= 40;
p2:= 60;
a1:= 5/p1;
a2:= 5/p2;
PB:= (a1-a2)*C + (a2*(1-a1)-a1*(1-a2))*Ref(C,-1) + ((1-a1) + (1-a2))*PREV - (1-a1)*(1-a2)*Ref(PREV,-1);
RMSa:= Sum( pb*pb, 50);
RMS:= Sqrt(RMSa/50);
es:= Cross(RMS,pb);
xs:= pb > Ref(pb, -1);
trade:= If(es, 1, If(xs, 0, PREV));
Cross(0.5, trade)
|