Download MetaTrader 5

Email alert problem at night ?

To add comments, please log in or register
mike
19
mike  
I set my email alerts during the night to wake me up if a trade is setup. My alerts do not work for some reason when my computer sits for several hours. They work fine when I am on my computer. I have turned off hibernate, standby, and screen savers. Does anyone have experience with this problem ? thx
Rashid Umarov
Admin
11993
Rashid Umarov  
Provide your code, may be it will help.
mike
19
mike  
Rosh:
Provide your code, may be it will help.
Thanks. Code is below. My email works fine when I am using my computer. If it idles for 1-2 hours I do not get an email.



#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
}
Dittharach Jindarak
120
Dittharach Jindarak  

i have the same problem with you

My sendmail work fine on first day

after that never send to my email again

must reset EA to keep it work

who know what cause this problem?

To add comments, please log in or register