logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
MS Support  
#1 Posted : Wednesday, August 13, 2025 8:54:12 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,994

Thanks: 95 times
Was thanked: 159 time(s) in 154 post(s)

John F. Ehlers’ article, “Making a Better Oscillator”, introduced his Cybernetic Oscillator and a Simple Rate of Change trading strategy. Here are the formulas to add that indicator and System Test to MetaStock.

The Cybernetic Oscillator:

Code:
{by John Ehlers}
HPLen:= 30;
LPLen:= 20;

{High Pass filter of Close} a1:= exp(-1.414*3.14159 / HPLen); b1:= 2*a1*Cos(1.414*180 / HPLen); c1:= -a1*a1; x1:= (1 + b1 - c1) / 4; HP1:= x1*(C - Ref(2*C,-1) + Ref(C, -2)) + b1*Prev + c1*Ref(Prev, -1);

{Super Smoother of High Pass} a2:= exp(-1.414*3.14159 / LPLen); b2:= 2*a2*Cos(1.414*180 / LPLen); c2:= -a2*a2; x2:= (1 + b2 - c2) / 4; LP1:= x2*(Sum(HP1,2)/2) + b2*Prev + c2*Ref(Prev, -1);

{Root Mean Square of Super Smoother} RMS:= SQRT(Sum(LP1 * LP1, 100) / 100);

{divide by zero trap} denom:= if(RMS = 0, -1, RMS); If(denom = -1, 0, LP1/denom)

Simple Rate of Change Strategy

Buy Order:

Code:
LPLen:= 20;
fastHPLen:= 55;
slowHPLen:= 156;

{Super Smoother of Close} a1:= exp(-1.414*3.14159 / LPLen); b1:= 2*a1*Cos(1.414*180 / LPLen); c1:= -a1*a1; x1:= (1 + b1 - c1) / 4; LP1:= x1*(Sum(C,2)/2) + b1*Prev + c1*Ref(Prev, -1);

{fast High Pass filter of Super Smoother} a2:= exp(-1.414*3.14159 / fastHPLen); b2:= 2*a2*Cos(1.414*180 / fastHPLen); c2:= -a2*a2; x2:= (1 + b2 - c2) / 4; HP1:= x2*(LP1 - Ref(2*LP1,-1) + Ref(LP1, -2)) + b2*Prev + c2*Ref(Prev, -1); ROC1:= HP1 - Ref(HP1, -2);

{slow High Pass filter of Super Smoother} a3:= exp(-1.414*3.14159 / slowHPLen); b3:= 2*a3*Cos(1.414*180 / slowHPLen); c3:= -a3*a3; x3:= (1 + b3 - c3) / 4; HP2:= x3*(LP1 - Ref(2*LP1,-1) + Ref(LP1, -2)) + b3*Prev + c3*Ref(Prev, -1); ROC2:= HP2 - Ref(HP2, -2);

ROC1>0 AND ROC2>0

Sell Order:

Code:
LPLen:= 20;
fastHPLen:= 55;
slowHPLen:= 156;

{Super Smoother of Close} a1:= exp(-1.414*3.14159 / LPLen); b1:= 2*a1*Cos(1.414*180 / LPLen); c1:= -a1*a1; x1:= (1 + b1 - c1) / 4; LP1:= x1*(Sum(C,2)/2) + b1*Prev + c1*Ref(Prev, -1);

{fast High Pass filter of Super Smoother} a2:= exp(-1.414*3.14159 / fastHPLen); b2:= 2*a2*Cos(1.414*180 / fastHPLen); c2:= -a2*a2; x2:= (1 + b2 - c2) / 4; HP1:= x2*(LP1 - Ref(2*LP1,-1) + Ref(LP1, -2)) + b2*Prev + c2*Ref(Prev, -1); ROC1:= HP1 - Ref(HP1, -2);

{slow High Pass filter of Super Smoother} a3:= exp(-1.414*3.14159 / slowHPLen); b3:= 2*a3*Cos(1.414*180 / slowHPLen); c3:= -a3*a3; x3:= (1 + b3 - c3) / 4; HP2:= x3*(LP1 - Ref(2*LP1,-1) + Ref(LP1, -2)) + b3*Prev + c3*Ref(Prev, -1); ROC2:= HP2 - Ref(HP2, -2);

ROC1<0 AND ROC2<0

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.