Typical mistakes and how to deal with them when dealing with the trading environment - page 10

 
Artyom Trishkin:

10009 TRADE_RETCODE_DONE - you have described it yourself - the order has been executed. This is simply the fact that the order has been successfully queued to the server for execution.

Further, if this order is executed (after all, it can be rejected by the server), then there is a trade - this is the result of the trade, with an opening price.

Read about

OnTradeTransaction

It is called in Expert Advisors when a TradeTransaction event occurs. The function is intended for processing the results of trade request execution.

voidOnTradeTransaction( )
const MqlTradeTransaction&trans,// structure of a trade transaction
const MqlTradeRequest&request,// request structure
const MqlTradeResult& result// structure of response
);

Thank you - I will.
 
fxsaber:

My own experience.


There is another option, but it is 'advanced'.

Thanks - I'll give it a try as soon as the market opens...
 
fxsaber:

My own experience.


There is another option, but it is 'advanced'.

Thank you - both options work.
Can you tell me, please, what is the "advanced" option?
 
Algotrader18:
Can you tell me, please, what is the "advanced" version?

https://www.mql5.com/ru/code/22166

TradeTransactions
TradeTransactions
  • www.mql5.com
Асинхронные торговые приказы обладают огромным преимуществом - высокая скорость при массовой отправке. Однако, распространению таких приказов мешает некоторое неудобство - данные о результате приказа возможно увидеть только в OnTradeTransaction. Такое обстоятельство заставляет обывателя строить событийную модель своей ТС, если хочется...
 
Thank you - I will read it.