Re: Ehlers Indicators for MT4

243
MaxTorque wrote: Sat Jul 25, 2020 3:50 am Hello mrtools,

why don´t appear the indicator ?
I´v tried several Broker and I´v compiled multiple times !

Regard
Try this version.

Re: Ehlers Indicators for MT4

244
Chintzki wrote: Fri Jul 24, 2020 2:11 pm 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.
Maybe try this version posted here viewtopic.php?p=1295415526#p1295415526


Re: Ehlers Indicators for MT4

248
josi wrote: Sun Jul 26, 2020 9:23 pm
I find it intersting that the change of MA-method (input: price pre filtering method) doesn't change anything whatsoever - looks like a glitch. But I'm no coder - so it's up to you to decide.
By default the price prefiltering period = 1, if you leave it like that all ma's will be the same.

Re: Ehlers Indicators for MT4

250
Ehlers Early Onset Trend

Released date: Tuesday, July 28th, 2020.

https://www.tradingview.com/script/aMxm ... set-Trend/
In his article in this issue, “The Quotient Transform,” author John Ehlers introduces the quotient transform (QT), a zero-lag filter that can be used for the purpose of timely trend detection. The QT is an advancement of the technique he presented in his January 2014 S&C article, “Predictive And Successful Indicators.” This time, the output of a roofing filter (which includes applying a high-pass filter and SuperSmoother filter) is normalized.
http://www.traders.com/documentation/feedbk_docs/2014/08/TradersTips.html#item1
Download here:
viewtopic.php?p=1295415779#p1295415779
.
.
Image
Image
These users thanked the author Banzai for the post (total 5):
Jimmy, moey_dw, mwaschkowski, RodrigoRT7, fxmoney


Who is online

Users browsing this forum: Amazon [Bot], ChatGPT [Bot], eka2, felixo, friend4you, kvak, Proximic [Bot], ssscary and 94 guests