Use something like this to count the open orders
Then dont open any more :)
--
int OpenTradesForMagicNumber(string SymbolToCheck, int MagicNumberToCheck) { int icnt, itotal, retval; retval=0; itotal=OrdersTotal(); for(icnt=0;icnt<itotal;icnt++) { OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES); // check for opened position, symbol & MagicNumber if(OrderType()<=OP_SELL && OrderSymbol()==SymbolToCheck && OrderMagicNumber()==MagicNumberToCheck) { retval++; //Print("Orders opened : ",retval); } } return(retval); }
Good Luck
-BB-
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
Dear Fellow Traders
Please, how do I ensure that in an EA, not more than N number of trades is opened in a single bar once my set of conditions is met.
Thank you all for your ealier replies. Rosh, Thanks a lot for those helpuful answers.