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
Thanks!
As I understand it, the concept of "active order" includes BUY and/or SELL positions, as well as pending orders set (accepted by broker).
If I have: Long and Short positions opened, and Buy Limit and Sell Stop set, then OrdersTotal() will return value =4. Right?
There may be an open BUY position and an active BUY order. I gave an example of code above, but perhaps it is easier to explain it in figures. How the TP of an open position triggers
Everything has long been accepted, and before writing documentation, it would probably be worthwhile to read Sergei Kovalev's tutorial (it's built into MQL4):
Everything is already taken care of, and before writing the documentation, it would probably be worthwhile to read Sergei Kovalev's tutorial (it is built into MQL4):
This is how a block can be constructed in which market and pending orders are analyzed:
{ //отражённым в терминале
if(OrderSelect(i-1,SELECT_BY_POS)==true)//Если есть следующий
{
// Здесь должен выполняться ..
// ..анализ характеристик ордеров
}
} //Конец тела цикла
The loop statement header contains the initial value i=1, and the condition for the loop termination is the expression i<=OrdersTotal(). Function OrdersTotal() returns the total amount of market and pending orders, i.e. those orders that are reflected in the Terminal on the Trade tab. Therefore, the number of iterations in the loop will be the number of orders present in the trade.
There's no need to cheat)
This is the code of MT4, and there is no division of orders and positions - everything is mixed together in it
Everything is already taken care of, and before writing the documentation, it would probably be worthwhile to read Sergei Kovalev's tutorial (it is built into MQL4):
This is how a block can be constructed in which market and pending orders are analyzed:
{ //отражённым в терминале
if(OrderSelect(i-1,SELECT_BY_POS)==true)//Если есть следующий
{
// Здесь должен выполняться ..
// ..анализ характеристик ордеров
}
} //Конец тела цикла
The loop statement header contains the initial value i=1, and the condition for the loop termination is the expression i<=OrdersTotal(). Function OrdersTotal() returns the total amount of market and pending orders, i.e. those orders that are reflected in the Terminal on the Trade tab. Therefore, the number of iterations in the loop will be the number of orders present in the trade.
Are the OrdersTotal() functions different in MQL4 and MQL5? It seems that the compiler is the same ....
Are the OrdersTotal() function in MQL4 and MQL5 different functions? The compiler seems to be the same ....
As for the trading functions, there are differences. I've already mentioned MQL4:
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5 language, tips and tricks
Vitaly Muzichenko, 2017.02.28 19:25
... I don't have any problems with mt4, and it has no division of orders and positions - it's all mixed together
Yes, different.
What's the difference?
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Vladimir Karputov, 2017.02.28 19:44
As for the trading functions - there are differences. I've already mentioned above about MQL4:
What's the difference?
OrdersTotal().
Returns the number of active orders.
intOrdersTotal();
Returned value
Value of the int type.
Note
One should not confuse between active pending orders and positions, which are also displayed in the "Trade" tab of the "Toolbox" panel. An order is an order to conduct a trade operation, and a position is the result of one or more trades.
With "netting" of positions (ACCOUNT_MARGIN_MODE_RETAIL_NETTING and ACCOUNT_MARGIN_MODE_EXCHANGE) only one position can be opened for each symbol at any given time and it is the result of one or more deals. Positions and active pending orders, which are also displayed in the "Trade" tab of the "Toolbox" panel, should not be confused with each other.
When the positions are presented independently (ACCOUNT_MARGIN_MODE_RETAIL_HEDGING), several positions can be opened for each symbol simultaneously.
PositionsTotal()
It returns the number of open positions.
intPositionsTotal();
Returned value
Value of the int type.
Note
With "netting" positions (ACCOUNT_MARGIN_MODE_RETAIL_NETTING and ACCOUNT_MARGIN_MODE_EXCHANGE) only one position can be opened for each symbol at any moment and that is the result of one or more trades. Positions and active pending orders, which are also displayed in the "Trade" tab of the "Toolbox" panel, should not be confused with each other.
In the independent representation of positions (ACCOUNT_MARGIN_MODE_RETAIL_HEDGING), several positions can be opened for each symbol simultaneously.