Re: Ehlers Indicators for MT4

234
4TUNE wrote: Tue May 26, 2020 8:09 pm
Hi MrTools
Hope this finds you well. l think theres a small error in the trendflex indicator with alerts. The fast/slow cross arrows seem to be oppossite. May you please have a look.AUDNZDM2.png
Thanks
Regards
Please check again on fast/slow cross i coded it if fast>slow up arrow and fast<slow down arrow.
Attachments
These users thanked the author mrtools for the post:
4TUNE

Re: Ehlers Indicators for MT4

235
mrtools wrote: Thu May 21, 2020 3:02 am

Please make sure, because if that was the case it wouldn't be working for anybody.
I´ve checked it out with two other broker and fresh mt4 installations.
Same error. This only for information, I will not use it, but perhaps some other traders.
Perhaps some other users can check it against. Thank you.
Greetings Markus
we can't change the wind, but we can set the sails differently


Re: Ehlers Indicators for MT4

236
marwilli wrote: Sat May 30, 2020 8:13 pm

I´ve checked it out with two other broker and fresh mt4 installations.
Same error. This only for information, I will not use it, but perhaps some other traders.
Perhaps some other users can check it against. Thank you.
Greetings Markus
Trying another version, hopefully it will work for you.
These users thanked the author mrtools for the post (total 2):
marwilli, pipsquirrel

Re: Ehlers Indicators for MT4

239
mrtools wrote: Thu Jul 09, 2020 2:05 am

Have the regular sinewave looks nothing like that one, any chance you would have the formula?
Unfortunately I do not. The picture was taken from page 35 on the attached PDF. Maybe you can understand it better than me.

It seems to behave similar to a fisher inverse transform?

I will continue to try to find the formula

Edit:
Perhaps this is the key?

Double Edit:
It almost looks like an ehler's MAMA just put onto an oscillator...?

Tripple Edit:
This looks closer...still not quite the same
Pages 159-164

Re: Ehlers Indicators for MT4

240
Please forgive my double post.

I'm sorry as I don't understand the code well, so I don't know if this is helpful, but I have found 3 possible formula.

I can't speak towards the effectiveness or authenticity of these codes but hopefully one of them is what we are looking for!

This first code says that it is from John Ehler's "Cybernetic Analysis for Stocks and Futures"

Code: Select all

{Sine Wave indicator - //// From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers //// code compiled by dn
} // plot on a subgraph separate from the price region.

Inputs: Price((H+L)/2), alpha(.07);

Vars: Smooth(0),Cycle(0),I1(0),Q1(0),I2(0),Q2(0),DeltaPhase(0),MedianDelta(0),MaxAmp(0),AmpFix(0),Re(0),Im(0),DC(0),
alpha1(0),InstPeriod(0),DCPeriod(0),count(0),SmoothCycle(0),RealPart(0),ImagPart(0),DCPhase(0);

Smooth = (Price+2*Price[1]+2*Price[2]+Price[3])/6;
Cycle = (1-.5*alpha)*(1-.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2];
If CurrentBar <7 then Cycle=(Price-2*Price[1]+Price[2])/4;
Q1=(.0962*Cycle+.5769*Cycle[2]-.5769*Cycle[4]-.0962*Cycle[6])*(.5+.08*InstPeriod[1]);
I1 = Cycle[3];
If Q1<>0 and Q1[1]<>0 then DeltaPhase=(I1/Q1-I1[1]/Q1[1])/(1+I1*I1[1]/(Q1*Q1[1]));
If DeltaPhase <0.1 then DeltaPhase=0.1;
If DeltaPhase > 1.1 then DeltaPhase = 1.1;
MedianDelta = Median(DeltaPhase,5);
If MedianDelta =0 then DC=15 else DC=6.28318/MedianDelta+.5;
InstPeriod=.33*DC+.67*InstPeriod[1];
Value1 = .15*InstPeriod+.85*Value1[1];
DCPeriod = IntPortion(Value1);
RealPart = 0;
ImagPart = 0;
For count = 0 To DCPeriod - 1 begin
RealPart = RealPart + Sine(360 * count / DCPeriod) * (Cycle[count]);
ImagPart = ImagPart + Cosine(360 * count / DCPeriod) * (Cycle[count]);
End;
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart);

DCPhase = DCPhase + 90;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;

Plot1(Sine(DCPhase), "Sine",blue);
Plot2(Sine(DCPhase + 45), "LeadSine",green);

{Note: This indicator tries to determine the current phase of the cycles you are in. A sinewave indicator has an advantage over
other oscillators such as RSI and Stochastic because it predicts rather than waits for confirmation. This assumes that the measured
phase has existed at least briefly in the past and will continue at least briefly into the future.
The phase languishes when the market is in a trend mode, and can even have a negative rate of change.
This indicator gives entry and exit signals 1/16th of a cycle period in advance of the cycle turning point
and seldom gives false whipsaw signals when the market is in a trend mode.}[/quote]


I found a website with a list of many of Ehler's formulas.

On that page the author has listed an a "special" version of the sinewave indicator.

It looks almost identical to the one written in Ehler's "Rocket Science for Traders Digital Signal Processing Applications" at first glance. If it is different or special, I can't tell how.

I have copied the code below.


[quote]{***************************************

Ehlers - Rocket Science for Traders
Sinewave Indicator (Figure 9.3)

****************************************}

Inputs:
Price((H+L)/2);

Vars:
Smooth(0),
Detrender(0),
I1(0),
Q1(0),
jI(0),
JQ(0),
I2(0),
Q2(0),
Re(0),
Im(0),
Period(0),
SmoothPeriod(0),
SmoothPrice(0),
DCPeriod(0),
RealPart(0),
Imagpart(0),
count(0),
DCPhase(0);

If CurrentBar > 5 Then Begin
Smooth = (4*Price + 3*Price[1] + 2*Price[2] + Price[3]) / 10;
Detrender = (.0962*Smooth + .5769*Smooth[2] - .5769*Smooth[4]
- .0962*Smooth[6])*(.075*Period[1] + .54);

{Compute InPhase and Quadrature components}
Q1 = (.0962*Detrender + .5769*Detrender[2] - .5769*Detrender[4]
- .0962*Detrender[6])*(.075*Period[1] + .54);
I1 = Detrender[3];

{Advance the phase of I1 and Q1 by 90 degrees}
jI = (.0962*I1 + .5769*I1[2] - .5769*I1[4] - .0962*I1[6])*(.075*Period[1] + .54);
JQ = (.0962*Q1 + .5769*Q1[2] - .5769*Q1[4] - .0962*Q1[6])*(.075*Period[1] + .54);

{Phasor addition for 3 bar averaging}
I2 = I1 - JQ;
Q2 = Q1 + jI;

{Smooth the I and Q components before applying the discriminator}
I2 = .2*I2 + .8*I2[1];
Q2 = .2*Q2 + .8*Q2[1];

{Homodyne Discriminator}
Re = I2*I2[1] + Q2*Q2[1];
Im = I2*Q2[1] - Q2*I2[1];
Re = .2*Re + .8*Re[1];
Im = .2*Im + .8*Im[1];

If Im <> 0 And Re <> 0 Then Period = 360/ArcTangent(Im/Re);
If Period > 1.5*Period[1] Then Period = 1.5*Period[1];
If Period < .67*Period[1] Then Period = .67*Period[1];
If Period < 6 Then Period = 6;
If Period > 50 Then Period = 50;
Period = .2*Period + .8*Period[1];
SmoothPeriod = .33*Period + .67*SmoothPeriod[1];

{Compute Dominant Cycle Phase}
SmoothPrice = (4*price + 3*Price[1] + 2*Price[2] + Price[3]) / 10;
DCPeriod = IntPortion(SmoothPeriod + .5);
RealPart = 0;
ImagPart = 0;

For count = 0 To DCPeriod - 1 Begin
RealPart = RealPart + Sine(360*count/DCPeriod)*(SmoothPrice[count]);
ImagPart = ImagPart + CoSine(360*count/DCPeriod)*(SmoothPrice[count]);
End;

If AbsValue(ImagPart) > 0 Then DCPhase = Arctangent(RealPart/ImagPart);
If AbsValue(ImagPart) <= .001 Then DCPhase = DCPhase + 90*Sign(RealPart);
DCPhase = DCPhase + 90;

{Compensate for one bar lag of the Weighted Moving Average}
DCPhase = DCPhase + 360 / SmoothPeriod;

If ImagPart < 0 Then DCPhase = DCPhase + 180;
If DCPhase > 315 Then DCPhase = DCPhase - 360;

Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
End;[/quote]


The third is from Ehler's "Cycle Analytics for Traders Advanced Technical Trading Concepts", the "Even Better Sinewave Indicator"


[quote]{
Even Better Sinewave Indicator
© 2013 John F. Ehlers
}
Inputs:
Duration(40);
Vars:
alpha1(0),
HP(0),
a1(0),
b1(0),
c1(0),
c2(0),
c3(0),
Filt(0),
count(0),
Wave(0),
Pwr(0);

//HighPass filter cyclic components whose periods are
shorter than Duration input
alpha1 = (1 - Sine (360 / Duration)) / Cosine(360 /
Duration);
HP = .5*(1 + alpha1)*(Close - Close[1]) + alpha1*HP[1];
//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];
//3 Bar average of Wave amplitude and power
Wave = (Filt + Filt[1] + Filt[2]) / 3;
Pwr = (Filt*Filt + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
//Normalize the Average Wave to Square Root of the Average
Power
Wave = Wave / SquareRoot(Pwr);
Plot1(Wave);

I will continue to search. I wish I could be of more help.

Also, is there a new/good version of either of the two following indicators?
  • Ehler's Super Smoother Filter
  • Ehler's MESA or MAMA (I have found the attached indicator on these forums, but it doesn't seem to work on my MT4. Not sure why, but I also have not yet tried to recompile it)

Thanks in advance for any help.


Who is online

Users browsing this forum: bbookgenius, DVanAssen, Majestic-12 [Bot], Telegram [Bot], Xxcoincoin and 98 guests