How to get the maximum number of open positions of broker's limit, not the number of Lots. I don't know using which function.
Thanks in advance
I think you can only get the maximum number of open pending orders. I don't think there is a limit on the number of positions.
https://www.mql5.com/en/docs/constants/environment_state/accountinformation
- www.mql5.com
I think you can only get the maximum number of open pending orders. I don't think there is a limit on the number of positions.
https://www.mql5.com/en/docs/constants/environment_state/accountinformation
Thank you, i see.
Is that really true?
At least one broker (Roboforex) has a limitation in number of open positions, not only in number of pending orders.
On the Roboforex site you can read:
Maximum number of open positions for MT5 accounts | 1000 |
Maximum number of active orders for MT5 accounts | 500 |
My question is: is there any MQL5 function to get the maximum number of open positions?
Thanka for your answer.
Matthias
Why have you posted your MT5 question in the MQL4 section, (bottom of the Root page)?
Why have you posted your MT5 question in the MQL4 section, (bottom of the Root page)?
How to get the maximum number of open positions of broker's limit, not the number of Lots. I don't know using which function.
Thanks in advance
very simple
@ sdlg
//+------------------------------------------------------------------+ //| accou.mq4 | //| Copyright 2021, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ double TotalOrderSize(string GlnSymbol) { double SymbolUsedOrder=0; int total = OrdersTotal(); for(int ih=total-1; ih>=0; ih--) { bool ddy=OrderSelect(ih, SELECT_BY_POS); if(OrderSymbol()==GlnSymbol) SymbolUsedOrder=SymbolUsedOrder+OrderLots(); } return SymbolUsedOrder; } void OnStart() { //--- double MaxLot=MarketInfo(Symbol(),MODE_MAXLOT); double total=TotalOrderSize(Symbol()); double UsableOrder=MaxLot-total; Alert("Max Lot Size="+string(MaxLot)+" Used Lots="+string(total)+" Usable Lots="+DoubleToStr(UsableOrder,2)); } //+------------------------------------------------------------------+
AccountInfoInteger(ACCOUNT_LIMIT_ORDERS)
ACCOUNT_LIMIT_ORDERS | Maximum allowed number of open positions and active pending orders (in total), 0 — unlimited | int |
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How to get the maximum number of open positions of broker's limit, not the number of Lots. I don't know using which function.
Thanks in advance