PureBytes Links
Trading Reference Links
|
Try this:
---
Count = Count + 1;
if MA1 crosses under MA2 then Count = 0;
if MA1 crosses over MA2 then Count = 0;
if Count = 3 then Alert("Third bar");
---
Bob Fulks
At 11:45 PM 8/6/2009, you wrote:
>Hi, I am looking for some help with an alert. Lets say Condition1 is one moving average and Condition2 is a second moving average and I don't want an alert when they cross, but 3 bars after they cross. I tried the following alert code if one crossed above the other, but it did not work. Any help would be appreciated. Trend = 00 ; Condition1= MA1 > MA2; Condition2= MA1 < MA2; if Condition1 then Trend = +01 ; if Condition2 then Trend = -01 ; if (Trend > 00) then begin UpCount = UpCount + 01 ; DnCount = 00 ; end ; if (Trend < 00) then begin DnCount = DnCount + 01 ; UpCount = 00 ; end ; if (UpCount = 03) then Alert ("Third bar") ; Don
|