Create a counter variable and set it to 0.
Create a loop to count down through all of the orders. The loop will execute OrderTotal() number of times.
Select each order and check whether the return of Symbol() matches the symbol you're interested. If it does, then add one to your counter variable.
There are plenty of examples in the forum if you take some time to look.
CB
maybe it could be like this:
bool symbolOrdered(string symbolToOrder) { for(int i = 0; i < OrdersTotal(); i++){ if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)){ if(symbolToOrder == OrderSymbol()){ return (true); } else { continue; } } else { return (false); } } return (false); }

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
Hello,
im trying to find out a way to use OrdersTotal() forjust one security symbol, while im running the EA for more than one. Can you help me pls?
regards, IceRage