int BuyCnt = 0; int SellCnt = 0; int BuyStopCnt = 0; int SellStopCnt = 0; int BuyLimitCnt = 0; int SellLimitCnt = 0; int cnt = OrdersTotal(); for (i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if (OrderSymbol() != Symbol()) continue; int type = OrderType(); if (type == OP_BUY) BuyCnt++; if (type == OP_SELL) SellCnt++; if (type == OP_BUYSTOP) BuyStopCnt++; if (type == OP_SELLSTOP) SellStopCnt++; if (type == OP_BUYLIMIT) BuyLimitCnt++; if (type == OP_SELLLIMIT) SellLimitCnt++; }
many thanks RickD.
and again, how from the totals drop -1 to execute it, RickD?
example
6 (buy set 6) + 6 (buylimit set 6) totals and take 1 (buystop set = 4)
buy 6 + buylimit 6 + buystop 1= the all total become 13 not 12!
how i from here -1 to execute?
say thanks
egt520
and again, how from the totals drop -1 to execute it, RickD?
example
6 (buy set 6) + 6 (buylimit set 6) totals and take 1 (buystop set = 4)
buy 6 + buylimit 6 + buystop 1= the all total become 13 not 12!
how i from here -1 to execute?
say thanks
egt520
for (int i=OrdersTotal()-1;i>=0;i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if (OrderMagicNumber()==magicNumber && OrderSymbol()==Symbol()) {/*execute*/} } }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
have any guide to teach me.
i am the begining. newbie ^^|
thanks
tytian