use forum search function.
How to use the OrdersTotal() correctly?
- www.mql5.com
In my demo account, I always get "0" when I use the function to get the total orders of the account.
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 used to count number of open orders using OrdersTotal but in mql5 the code is not working well. Here is my mql4 code that now doesnt work in mql5
for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available
{
if(OrderMagicNumber()==0001) {int halt1=1;}
if(OrderMagicNumber()==0002) {int halt2=1;}
if(OrderMagicNumber()==0003) {int halt3=1;}
if(OrderMagicNumber()==0004) {int halt4=1;}
if(OrderMagicNumber()==0005) {int halt5=1;}
}
}
}
if(halt1!=1){ //do something }
How can i implement such a script in mql5?