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
If you run this EA on an account with no current positions or orders.
and then manually close the position opened by the EA, then there will be three open positions on the hedge (on the netting triple volume position).
Is this the correct behaviour? I probably do not understand the Terminal correctly. Then please clarify.
First of all you should read the help.
https://www.mql5.com/ru/docs/event_handlers/ontrade
Please note:
Simply put, the OnTrade() handler can be called for each individual trade. The consequence of closing a position can be the arrival of several separate transactions.
This is easily checked - just add Print() to OnTrade() of your example.
Plus I want to draw your attention to your previous test that you in vain expect to know the order ticket through OrderSendAsync().
Plus I want to draw your attention, according to your previous test, that you expect in vain to find out the order ticket via OrderSendAsync().
It seems that it's not there anywhere. Only HistorySelect lags in OnTrade.
It doesn't seem to be there anywhere. Only the HistorySelect lags in OnTrade are shown.
The first thing to do is to read the fact sheet.
https://www.mql5.com/ru/docs/event_handlers/ontrade
Please note:
Simply put, the OnTrade() handler can be called for each individual trade transaction. The consequence of closing a position can be the arrival of several separate transactions.
It is easily checked - just add Print() to OnTrade() of your example.
Of course, I have made the print. The question was not about the number of OnTrade calls but about the number of open positions.
After the first OnTrade, a market order is placed. On the next OnTrade, this market order must not allow opening more orders by the condition. But in the next OnTrade, the sum of OrdersTotal() + PositionsTotal() is also zero. Is it correct?
Thanks, I didn't see the copy-paste piece.
It doesn't seem to be there anywhere. Only HistorySelect lags in OnTrade are shown.
Caching of order selections still improved today, will be beta in a few hours.
Caching of order selections still improved today, will be beta in a few hours.
Do you mean HistorySelect? Just the auto-link does not lead to OrderSelect.
Any idea why mt5 does not feature the 'Commissions' tab? They only pop up after a trade is closed.
Any idea why mt5 does not feature 'Commissions' tab? They only pop up after a trade is closed.
Did the printout, of course. The question was not the number of OnTrade calls, but the number of open positions.
After the first OnTrade, a market order is placed. On the next OnTrade, this market order must not allow opening more orders by the condition. But in the next OnTrade, the sum of OrdersTotal() + PositionsTotal() is also zero. Is it correct?
It's all in the help: https://www.mql5.com/ru/docs/trading/ordersendasync
Everything is in the help: https://www.mql5.com/ru/docs/trading/ordersendasync
https://www.mql5.com/ru/docs/constants/tradingconstants/orderproperties#enum_order_state
Each order has a status that describes its status. To get information, useOrderGetInteger() orHistoryOrderGetInteger() function with modifier ORDER_STATE. Valid values are stored in the ENUM_ORDER_STATE enumeration.
ENUM_ORDER_STATE
Identifier
Description
ORDER_STATE_STARTED
Order checked for correctness, but not yet accepted by the broker
Doesn't Started-state occur after a successful OrderSendAsync?