PureBytes Links
Trading Reference Links
|
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
|