MA Crose Over Alert

#1
Hello,
I trying to get alert when MA cross over once for sell signal and once for buy signal .But it keeps alerting every tick. Could you please someone help me? thanks

Code:
Buy1 = EMA(C,9) > EMA(C,20);
Sell1 = EMA(C,9) < EMA(C,20) ;

Buy = ExRem(Buy1, Sell1) ;
Sell = ExRem(Sell1, Buy1) ;

IIf(Buy,Say(Name()+" Cross over"),0);
 
#2
Buy1 = EMA(C,9) > EMA(C,20);
Sell1 = EMA(C,9) < EMA(C,20) ;

Buy = ExRem(Buy1, Sell1) ;
Sell = ExRem(Sell1, Buy1) ;
for( i = 0; i < BarCount; i++ )
IIf(Buy,Say(Name()+" Cross over"),0);
 

Similar threads