John Ehler's Squelch

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

John Ehler's Squelch

Postby jefftrader » Tue Aug 17, 2010 6:26 am

I found this on a "john ehlers blog". he calls it a squelch filter. basically it paints the bars different colors based on whether it determines there is a trend or in a cycle. Am hoping this can be converted into lua.

thanks again for your help and support.

jefftrader



the easy language code is (and the chart pic is attached)
SquelchPIC.JPG
:

EasyLanguage code to implement the Squelch Control as a Paintbar


Inputs: Price((H+L)/2),
Squelch(20);

Vars: InPhase(0),
Quadrature(0),
Phase(0),
DeltaPhase(0),
count(0),
InstPeriod(0),
Period(0);

If CurrentBar > 5 then begin

{Compute InPhase and Quadrature components}
Value1 = Price - Price[6];
Value2 =Value1[3];
Value3 =.75*(Value1 - Value1[6]) + .25*(Value1[2] - Value1[4]);
InPhase = .33*Value2 + .67*InPhase[1];
Quadrature = .2*Value3 + .8*Quadrature[1];

{Use ArcTangent to compute the current phase}
If AbsValue(InPhase +InPhase[1]) > 0 then Phase = ArcTangent(AbsValue((Quadrature+Quadrature[1]) / (InPhase+InPhase[1])));

{Resolve the ArcTangent ambiguity}
If InPhase < 0 and Quadrature > 0 then Phase = 180 - Phase;
If InPhase < 0 and Quadrature < 0 then Phase = 180 + Phase;
If InPhase > 0 and Quadrature < 0 then Phase = 360 - Phase;

{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
DeltaPhase = Phase[1] - Phase;
If Phase[1] < 90 and Phase > 270 then DeltaPhase = 360 + Phase[1] - Phase;
If DeltaPhase < 1 then DeltaPhase = 1;
If DeltaPhase > 60 then Deltaphase = 60;

{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 40 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;

{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Period = .25*InstPeriod + .75*Period[1];

If Period < Squelch then begin
Plot1(High,"High");
Plot2(Low,"Low");
end;

end;
jefftrader
 
Posts: 28
Joined: Tue Jul 13, 2010 4:13 pm


Re: John Ehler's Squelch

Postby jefftrader » Mon Aug 23, 2010 4:33 am

Just checking on status of this one. I have seen several others completed since this was put in the development que so I just wanted to check on it........

thanks,

jefftrader
jefftrader
 
Posts: 28
Joined: Tue Jul 13, 2010 4:13 pm

Re: John Ehler's Squelch

Postby Apprentice » Mon Aug 23, 2010 12:25 pm

I have made a difficult part of work towards fulfilling your request.
If you are able, I would ask you to test this indicator.
The rest of your application is easy to fill.

viewtopic.php?f=17&t=1908
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36476
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: John Ehler's Squelch

Postby jefftrader » Tue Aug 24, 2010 4:23 am

thank you. i will test it right now............

jefftrader
jefftrader
 
Posts: 28
Joined: Tue Jul 13, 2010 4:13 pm

Re: John Ehler's Squelch

Postby Apprentice » Tue Aug 24, 2010 5:03 am

Test.png


First, I do not remember when I was so much trouble with some indicator.
I tried to implement the code that you submitted.
The results have been pretty useless.

On the Internet, I found three different formulas.

This test Indicator has the option of using all three implementations.
View options.
Use 1, 2 or 3

JES.lua
(4.65 KiB) Downloaded 767 times

Squelch Trend.lua
(3.25 KiB) Downloaded 728 times

Install both indicators from this post.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36476
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 21 guests

cron