cochran1:
I have receive 100's of email alerts sometimes on the indicator below. Can someone help me correct this ? I would like 1 email per bar if possible. thx
double price0 = iMA(Symbol(),0,1,0,1,PriceMode,0)
price0 is likely to change every tick. That makes macross signal to trigger every time the price churns around the cross.
Irtron:
double price0 = iMA(Symbol(),0,1,0,1,PriceMode,0)
price0 is likely to change every tick. That makes macross signal to trigger every time the price churns around the cross.
cochran1:
I have receive 100's of email alerts sometimes on the indicator below. Can someone help me correct this ? I would like 1 email per bar if possible. thx
double price0 = iMA(Symbol(),0,1,0,1,PriceMode,0)
price0 is likely to change every tick. That makes macross signal to trigger every time the price churns around the cross.
Thanks. Do you have a suggestion on how to code this ?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have receive 100's of email alerts sometimes on the indicator below. Can someone help me correct this ? I would like 1 email per bar if possible. thx
#property indicator_chart_window
extern int MA1.period =5; //Period 5
extern int MA1.shift=0;
extern int MA1.method=2; //SMMA
extern int lMA1.price=2; //MA set to candle high
extern int sMA1.price=3; //MA set to candle low
extern int PriceMode = 6; //(high+low+close+close)/4
int cBar,pBarLong,pBarShort;
int start()
{
cBar = Time[0];
if(CheckMACross(1)== 1 && cBar!=pBarLong ) {EmailAlert(1); pBarLong=cBar;}
else
if(CheckMACross(2)==-1 && cBar!=pBarShort) {EmailAlert(2); pBarShort=cBar;}
return(0);
}
int CheckMACross(int mode)
{
if(mode==1) int price = lMA1.price;
else
if(mode==2) price = sMA1.price;
double price1 = iMA(Symbol(),0,1,0,1,PriceMode,1);
double ma1 = iMA(Symbol(),0,MA1.period,MA1.shift,MA1.method, price,1);
double price0 = iMA(Symbol(),0,1,0,1,PriceMode,0);
double ma0 = iMA(Symbol(),0,MA1.period,MA1.shift,MA1.method, price,0);
if(ma1 > price1 && ma0 <= price0) return( 1);
else
if(ma1 < price1 && ma0 >= price0) return(-1);
else
return(0);
}
void EmailAlert(int mode)
{
if(mode == 1) SendMail("Signal for LONG",Symbol()+" Go Long"); //SendMail
else
if(mode == 2) SendMail("Signal for SHORT",Symbol()+" Go Short");//SendMail
}