just saw MrTools post from MladenscarletPip wrote: Sun Dec 25, 2022 5:06 pm Thanks for this. Does anyone know where I can find the modified Stochastic indicator by Ehlers from his classic 'Cycle Analytics'? For MT4 preferably?
This is the EasyLanguage code snippet he provides in Chapter 7.
Code: Select all
{ Modified Stochastic Indicator © 2013 John F. Ehlers } Inputs: Length(20); Vars: alpha1(0), HP(0), a1(0), b1(0), c1(0), c2(0), c3(0), Filt(0), HighestC(0), LowestC(0), count(0), Stoc(0), MyStochastic(0); //Highpass filter cyclic components whose periods are shorter than 48 bars alpha1 = (Cosine(.707*360 / 48) + Sine (.707*360 / 48) - 1) / Cosine(.707*360 / 48); HP = (1 - alpha1 / 2)*(1 - alpha1 / 2)*(Close - 2*Close[1] + Close[2]) + 2*(1 - alpha1)*HP[1] - (1 - alpha1)*(1 - alpha1)*HP[2]; //Smooth with a Super Smoother Filter from equation 3-3 a1 = expvalue(-1.414*3.14159 / 10); b1 = 2*a1*Cosine(1.414*180 / 10); c2 = b1; c3 = -a1*a1; c1 = 1 - c2 - c3; Filt = c1*(HP + HP[1]) / 2 + c2*Filt[1] + c3*Filt[2]; HighestC = Filt; LowestC = Filt; For count = 0 to Length - 1 Begin If Filt[count] > HighestC then HighestC = Filt[count]; If Filt[count] < LowestC then LowestC = Filt[count]; End; Stoc = (Filt - LowestC) / (HighestC - LowestC); MyStochastic = c1*(Stoc + Stoc[1]) / 2 + c2*MyStochastic[1] + c3*MyStochastic[2]; Plot1(MyStochastic);
my version has a tunable alpha1 parameter. Not sure if it's better though