if ( ( symbols == 3 ) && ( ArraySize( ordersopen ) == 0 ) ) { return; //end execution }
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
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
Hi, I am making an expert advisor that runs on every tick. I am trying to find a way to end the execution of the script prematurely when a condition is met early on in the script, and then the script won't execute again until the next tick. I know I could just put the entire code after the condition into a an if statement, but am wondering if there's a more elegant method?
As you can see from my code, the condition that should end the execution of the script is if the number of symbols with open positions is equal to 3, and that the current symbol doesn't have any open positions. I'm using MQL4 by the way.