FORTS: OnTradeTransaction() return codes - page 11

 
Dmitry Fedoseev:
It is not clear exactly what state the order was in.

To REMOVE an order, it is important that it DOES exist and is not in an "in-between" state.

Look carefully (with all explanations):

https://www.mql5.com/ru/forum/58012/page9#comment_2074928

ФОРТС: OnTradeTransaction() коды возврата
ФОРТС: OnTradeTransaction() коды возврата
  • www.mql5.com
Сейчас, коды возврата торгового сервера функции OnTradeTransaction() выглядят так:. - Страница 9 - Категория: биржевой трейдинг
 
Михаил:

To REMOVE an order, it is important that it DOES exist and is not in an "in-between" state.

Look carefully (with all explanations):

https://www.mql5.com/ru/forum/58012/page9#comment_2074928

Still interesting, and might be useful, as a clear argument to servicedesk.
 
Dmitry Fedoseev:
Still interesting, and might be useful, as a clear argument for the servicedesk.

So you think the CheckOrderState() function is not written correctly?

P/S SD, silent as always....

 
Михаил:

So you think the CheckOrderState() function is not written correctly?

P/S SD, silent as always....

I don't know. If it was ORDER_STATE_PLACED, it's probably the same bug.

And if it was ORDER_STATE_PARTIAL, I don't know. Alexander didn't tell us about this case and maybe there are some subtleties.

In any case, the function can be improved to know exactly what state the order had.

 
Dmitry Fedoseev:

I don't know. If it was ORDER_STATE_PLACED, it's probably the same bug.

And if it was ORDER_STATE_PARTIAL, I don't know. Alexander didn't tell us about this case, maybe there are some subtleties.

In any case, the function can be improved to know what exactly was the state of the order.

Perhaps it can be improved, but (in my opinion) the following is important:

1. When the order is in an intermediate state, viz:

ORDER_STATE_STARTED

ORDER_STATE_REQUEST_ADD

ORDER_STATE_REQUEST_MODIFY

ORDER_STATE_REQUEST_CANCEL

then nothing can be done with it, so ORD_BUSY

(I don't see the point of these states at all)

2. If the order is not in the history, it DOES exist, and can take ONLY

two states:

ORDER_STATE_PARTIAL = ORD_EXIST_PARTIAL

ORDER_STATE_PLACED = ORD_EXIST

3. All these conclusions are not taken "from the ceiling", but from MQL5 documentation,

and if the developers have any "peculiarities" they MUST

outline them in the manual!

4. I, for example, am not clairvoyant and can't know what the developers meant by

when they wrote this or that function.

Whatever explanation they gave you, that's the result!

P/S Of course, you may misunderstand something, but not in this case.

 

Why is there no return code when the order is "kicked back" by the broker (exchange)?

case ORDER_NONE_REJECTED:
              Print( __FUNCTION__, ": Main ордер отклонён брокером(биржей). Билет = ", trans.order, " Причина: ", result.retcode, " ", result.retcode_external );
            break

2016.09.02 16:11:05.687 trader (GAZR-12.16,H1)    OnTradeTransaction: Main ордер отклонён брокером(биржей). Билет = 43595612 Причина: 0 0
2016.09.02 16:11:05.687 Trades  'xxxxx': exchange buy 9.00 GAZR-12.16 at market
2016.09.02 16:11:05.687 Trades  'xxxxx': accepted exchange buy 9.00 GAZR-12.16 at market
2016.09.02 16:11:05.687 Trades  'xxxxx': exchange buy 9.00 GAZR-12.16 at market placed for execution in 11.344 ms
2016.09.02 16:18:45.902 Trades  'xxxxx': buy limit 9.00 GAZR-3.17 at 14165
2016.09.02 16:18:45.908 Trades  'xxxxx': accepted buy limit 9.00 GAZR-3.17 at 14165
2016.09.02 16:18:45.909 Trades  'xxxxx': buy limit 9.00 GAZR-3.17 at 14165 placed for execution
 
prostotrader:

Why is there no return code when the order is "kicked back" by the broker (exchange)?

There is not always this code when you give the execution to a party.

We will check the gateways and consider filling in this return code if we find the exact answers.

 
Renat Fatkhullin:

This code is not always there when you give the execution to a party.

We will check the gateways and consider filling in this return code.

Thank you.
 

Today there was some kind of glitch on the MT5 server Orders were redirected but no reason (0 0).....

Print( __FUNCTION__, ": Buy ордер отклонён брокером(биржей). Билет = ", trans.order,
                                   " Причина: ", result.retcode, " ", result.retcode_external );

2016.10.20 20:31:08.793 trader (PLT-12.16,H1)     OnTradeTransaction: Buy ордер отклонён брокером(биржей). Билет = 46614026 Причина: 0 0
2016.10.20 20:31:08.797 trader (TATN-12.16,H1)    StopTrading: Время сервера = 20:31:08; Статус ордера = BUY_ORDER; Билет = 46614027  Ордер отклонён.
2016.10.20 20:31:08.797 trader (TATN-12.16,H1)    OnTradeTransaction: Buy ордер отклонён брокером(биржей). Билет = 46614027 Причина: 0 0
2016.10.20 20:31:08.801 trader (BR-12.16,M1)      StopTrading: Время сервера = 20:31:08; Статус ордера = SELL_ORDER; Билет = 46614028  Ордер отклонён.
2016.10.20 20:31:08.801 trader (BR-12.16,M1)      OnTradeTransaction: Sell ордер отклонён брокером(биржей). Билет = 46614028 Причина: 0 0
2016.10.20 20:31:08.804 trader (SNGP-12.16,H1)    StopTrading: Время сервера = 20:31:08; Статус ордера = BUY_ORDER; Билет = 46614029  Ордер отклонён.
2016.10.20 20:31:08.804 trader (SNGP-12.16,H1)    OnTradeTransaction: Buy ордер отклонён брокером(биржей). Билет = 46614029 Причина: 0 0
2016.10.20 20:31:08.806 trader (MXI-12.16,M1)     StopTrading: Время сервера = 20:31:08; Статус ордера = BUY_ORDER; Билет = 46614030  Ордер отклонён.
Reason: