MQL4 - automated forex trading   /  

Forum

Send Email On Pre Set Time not Working, event is not firing !

Back to topics list To post a new topic, please log in or register

avatar
51
icm63 2007.03.26 11:55 
I have this function in start...IT DOES NOT FIRE !!!
- Its on a EA, with all common EA properties clicked on !
- Tick action from chart occured during this time frame.

Why does it not send an email.

The OK Variable is there to make sure it ony sends an email once, and not on every tick !



void Start()
{
EmailAction();

}


void EmailAction()
{
int OK1 = 0;

// If local time is 4 pm and minute is 0 ( ie first 60 seconds of the hour) then send email.

if(TimeHour(TimeLocal()) == 16 && TimeMinute(TimeLocal()) ==0 && OK1 != 1)
{
SendMail( "TEST_Status_"+TimeToStr(TimeLocal(), TIME_DATE|TIME_MINUTES), "TEST" );
OK1 = 1;
}
else
OK1 = 0;

return(0);
}
article

Video interview with Rashid Umarov

The main conclusion is that it is insufficient to have a profitable strategy: it is necessary to strengthen its advantages and smooth its disadvantages. This is the point in money management: You should gain the largest profit from your approach, your Expert Advisor, your system with minimal risk and in maximal amounts, without being short of it. This is the most important thing, to my mind.


avatar
Moderator
28803
Rosh 2007.03.26 10:31 
See http://www.metaquotes.net/forum/2872/
Please, use MQL4 button for inserting of a code.

avatar
51
icm63 2007.03.26 11:58 



So how can I make an email occur every time at or near a certain time , no matter if a tick occurs ???


avatar
Moderator
28803
Rosh 2007.03.26 12:14 
You need use endless looped script with while(). For example:
while(!IsStopped())
{
// operators
Sleep(1000);
}

See IsStopped
Back to topics list  

To add comments, please log in or register