Forex
Google

Go Back   Forex Trading > Discussion Areas > Suggestions for Trading Systems
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2006, 02:08 PM
cucurucu's Avatar
cucurucu cucurucu is offline
Senior Member
 
Join Date: Jan 2006
Posts: 315
cucurucu is on a distinguished road
Lightbulb Squelch Control Indicator

Hi,

I have the EasyLanguage code to implement the Squelch Control as a Paintbar and I need someone to write an indicator for MT4. This indicator was writen by John Ehlers. I think it's very useful.



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;
Attached Images
File Type: gif Squelch.gif (26.2 KB, 206 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-08-2006, 10:35 PM
Eric Eric is offline
Senior Member
 
Join Date: Sep 2005
Location: Kailua-Kona, Hawai'i
Posts: 187
Eric is on a distinguished road
So this indicator paints the bars as in your attached screen? It looks nice as long as it is not painting past bars. I would like to try it out too but unfortunately I am not a programmer :[
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-09-2006, 07:47 AM
cucurucu's Avatar
cucurucu cucurucu is offline
Senior Member
 
Join Date: Jan 2006
Posts: 315
cucurucu is on a distinguished road
Yes, it paints the bars as in attached screen but i haven't seen it "in action" so I don't know if it paints the past. I hope it doesn't.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-09-2006, 07:51 AM
igorad's Avatar
igorad igorad is offline
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 782
igorad is on a distinguished road
Hi,
I rewrote this indicator for MQL4, but I think, that in it there is a bug.
I should check it on TS.

Igor
Attached Files
File Type: mq4 SCI_v1.mq4 (4.8 KB, 62 views)
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory

Last edited by igorad : 02-09-2006 at 07:54 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-09-2006, 08:25 AM
cucurucu's Avatar
cucurucu cucurucu is offline
Senior Member
 
Join Date: Jan 2006
Posts: 315
cucurucu is on a distinguished road
Unhappy

Hi Igor,

Thank you for the indicator.
It seems though, there is something wrong with it. It suppose to paint blue all the bars of an uptrend and red for the rest(downtrend & ranging periods). I can see lots of downtrends in blue (instead of red). Maybe there was an error in the formula I posted.
If I can find that formula elsewhere, I will post the corrections.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
multi-account control using EA white_tiger Expert Advisors - Metatrader 4 3 11-06-2006 03:52 AM
Control Points inwestorthc Setup Questions 1 10-18-2006 11:27 AM
NewsTracker to control EAs around newstime phampton Metatrader 4 1 08-25-2006 08:27 AM
Need help about trade time control DHALSIM Metatrader 4 1 08-06-2006 03:27 AM


All times are GMT. The time now is 06:28 AM.