Morning all
I have an EA which is designed to send a confirmation email when an order is executed.
The 'orderselect' (Not to be confused with the MQL4 OrderSelect(...) function) function is called in the OnTick() section of the EA. Just to be clear, I am aware as to the implication of the OnTick() function, in that anything in the OnTick() section takes place on every incoming tick.
However, I have section which is attempting to tell the terminal to have three attempts to sending a confirmation email via the SendMail(...) function, when it gets to the 3rd attempt, its to print an error.
Looking at the code below, why am I still getting emails into infinity despite telling it to only give the terminal three attempts, then to break the loop?
The function below is an external file and called from the OnTick() section.
Thanks
start with....
if(transMessage == -1){ static int tryMe = 0; tryMe++; <<<<<<<<< you can't alter a static variable if(tryMe >= 3){ <<<<<<<<<<<<<<< tryMe will always have a value less than 3 at this point tryMe=0; Print("<!>___",__LINE__," OrderSend failed with Error: " + (string)GetLastError()); return false; } else {
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Morning all
I have an EA which is designed to send a confirmation email when an order is executed.
The 'orderselect' (Not to be confused with the MQL4 OrderSelect(...) function) function is called in the OnTick() section of the EA. Just to be clear, I am aware as to the implication of the OnTick() function, in that anything in the OnTick() section takes place on every incoming tick.
However, I have section which is attempting to tell the terminal to have three attempts to sending a confirmation email via the SendMail(...) function, when it gets to the 3rd attempt, its to print an error.
Looking at the code below, why am I still getting emails into infinity despite telling it to only give the terminal three attempts, then to break the loop?
The function below is an external file and called from the OnTick() section.
Thanks