[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ALERT HELP!



PureBytes Links

Trading Reference Links

Don't know what you mean "triggers on the first bar".

I had it plot the bar of the alert and it plots on the third bar after the cross as expected. See attached picture.

Code is listed below.

Bob Fulks

----

Input: Fast_Length(9), Slow_Length(21);

Vars: MA1(Close), MA2(Close), Count(0);
        
MA1 = Average(Close, Fast_Length);
MA2 = Average(Close, Slow_Length);

Count = Count + 1;

if MA1 crosses under MA2 then Count = 0;
if MA1 crosses over  MA2 then Count = 0;

Plot1(MA1, "MA1");
Plot2(MA2, "MA2");

if Count = 3 then begin
        Plot3(Close, "Alert");
        Alert("Third bar");
end;

----


At 10:04 AM 8/7/2009, Macro Vector wrote:

>Hi Bob, Thanks so much for your input, but using your code, the alert still triggers on the first bar. 
>Regards, Don 




>******************************** --- On Fri, 8/7/09, Bob Fulks <omegalist@xxxxxxxxxxxx> wrote: > From: Bob Fulks <omegalist@xxxxxxxxxxxx> > Subject: Re: ALERT HELP! > To: "Macro Vector" <macrovector2@xxxxxxxxx> > Cc: omega-list@xxxxxxxxxx > Date: Friday, August 7, 2009, 12:19 PM > >  > 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       >  > >       

Attachment: OmegaList.102.png
Description: PNG image