FORTS: OnTradeTransaction() return codes - page 2

 
Михаил:

You and I are speaking "different languages".

The order, can be deleted as a result of a cross transaction,

and an ORDER_STATE_CANCELED with a return code of "0".

This has nothing to do with the broker.

You understand that MT5 is a universal platform and when adapting to the conditions of a particular gateway, the Broker (every broker) configures the server part in his own way.

What the broker programmer writes on the server will return.

So, the question should be solved directly with the technical support department of the broker. Only they have the logs of the server, only they can clarify the situation.

In this case, any outside observer can not even be sure that these are real return codes, it is written by your code, and the code is not attached.

And logging such fast functions through printers often gives a mess. It would be good to reproduce the situation (I understand difficult), and preferably with string logging followed by dumping into a file.

In any case, it's impossible to figure it out without a CD Broker.

 
Nikolay Demko:

You understand that MT5 is a universal platform, and when adapting to the conditions of a particular gateway, the Broker (each broker) configures the server part in his own way.

What the broker programmer writes the server will return.

So, the question should be solved directly with the technical support department of the broker. Only they have the logs of the server, only they can clarify the situation.

In this case, any outside observer can not even be sure that these are real return codes, it is written by your code, and the code is not attached.

And logging such fast functions through printers often gives a mess. It would be good to reproduce the situation (I understand difficult), and preferably with string logging followed by dumping into a file.

In any case, I repeat, without a CD broker is impossible to understand.

Dear Nikolai!

If EVERY broker's pgrammer will write "their" return codes....

Think about what would happen :)

 
Михаил:

Dear Nikolai!

If EVERY brokers pgrammer writes "their" return codes....

Think about what would happen :)

Don't overreact, the broker programmer configures the server once at pre-launch, and not just anything, but only from the available set.

But setting up the server is an intellectual thing, the manufacturer has made provisions for options, but to develop in advance some schemes of setting up a bit complicated, it depends on what kind of conditions at which broker.

Therefore the configuration of the server part is done at the broker, for one thing. The second reason why you have to contact the broker is because he has a log of the server part, and only when the broker says so-and-so, this server bug is already possible to MQ, although in this case, you do not have to worry, they themselves will contact the developer.

 
Nikolay Demko:

Don't overdo it, the broker's programmer configures the server once during the pre-launch preparation, and not just anything, but from the available set.

But setting up the server is an intelligent thing, the manufacturer has provided for the possible options, but it is difficult to develop in advance some configuration schemes, it depends on what kind of conditions a broker has.

Therefore the configuration of the server part is done at the broker, for one thing. The second reason why contact the broker, it is because he has a server side logs and only when the broker says so-and-so, this server bug is already possible to MQ, although in this case, you do not have to worry, they themselves will contact the developer.

Response from the broker:

Good afternoon.

No, this setting is on the developers side.

At the end of last year the following question was raised:

Moscow Exchange fines for erroneous transactions. The full regulation can be seen athttp://fs.moex.com/files/4266

So, for example, the exchange penalises:

Transaction type*.

Result of execution (error code)*

Score Q

AddOrder

Cross-trade occurred (31)

Q1

Insufficient customer funds (332)

Q2

Insufficient funds from brokerage firm (333)

Q3

FOK bid not consolidated (4103)

Q4

DelOrder

Order not found (14)

Q5

MoveOrder

Cross-dealing occurred (31)

Q6

No order was found (50)

Q7

Insufficient customer funds (332)

Q8

Insufficient funds of the brokerage firm (333)

Q9

DelUserOrders

The transaction was completed successfully,

and no order is deleted

Q10

In MT5 there are no other return codes in the "trade server return codes" except for the "not enough client funds" return code.

The following response was receivedfromMetaQuotes

Hello,

1. Unfortunately, the issue with the translation of exchange return codes in one form or another is not simple and requires a number of changes. We are currently searching for the most appropriate solution. Most likely the required functionality will be added during next year.

2. Regarding the table of erroneous transactions - taking into account that the MT5 trading server carries out a preliminary check of client's trade requests (including the control of margin requirements), the exchange can actually be refused in 2 cases:

Transaction type*

Execution result (error code)*

Q score

AddOrder

Cross-trade occurred (31)

Q1

Insufficient customer funds (332)

Q2

Insufficient funds from brokerage firm (333)

Q3

FOK bid not consolidated (4103)

Q4

DelOrder

Order not found (14)

Q5

MoveOrder

Cross-dealing occurred (31)

Q6

No order was found (50)

Q7

Insufficient customer funds (332)

Q8

Insufficient funds of the brokerage firm (333)

Q9

DelUserOrders

The transaction was completed successfully,

and no order is deleted

Q10


Both of which are virtually unlikely.

Regards,

Mikhail Baturov

Head of Trading Systems User Support

Management of Trading Systems Support

Otkritie Brokerage House

 

Sometimes, MQs are stumped in some answers.

Example:

MQ:"Both of which are virtually unlikely."

It's little wonder what the reason for the failure was!

There was a change on the MGNT symbol on 12.05.2015 (the price step became 1,

prices should be integers)

The broker is probably not keeping track of the exchange changes:

If I didn't have return code protection in my EA,

then I would get thousands of transactions in a few seconds:

2015.05.15 10:00:10.051 Forts_trader (MGNT-6.15,H1)     StopTrading: Неправильная цена в запросе

And such a situation should also be "unlikely"!


 

Dear developers!

Please answer, when will you finally pay

attention to the RETURN CODES of the trading server?

When an MT5 server "glitches" or an exchange crashes, the following happens:

The Expert Advisor sends orders to delete an EXISTING order, but the response comes back

"Invalid request" !!!! And the Expert Advisor keeps "pounding" the server with orders to delete

order.

//+------------------------------------------------------------------+
// Remove order                                                      |
//+------------------------------------------------------------------+
void COrder::Remove()
{
  if ( ticket > 0 )
  {
    if ( OrderSelect( ticket ) )
    {
      mem_magic = ulong( OrderGetInteger( ORDER_MAGIC ) );
      mem_tick = GetTickCount();
      req_id = 0;
      MqlTradeRequest request = {0};
      MqlTradeResult  result  = {0};
            
      request.action = TRADE_ACTION_REMOVE;
      request.order = ticket;
          
      if ( OrderSendAsync( request, result ) )
      {
        if ( result.retcode == TRADE_RETCODE_PLACED )
        { 
          req_id = result.request_id;
//---          
          switch( order_status )
          {
            case BUY_ORDER:  state = ORD_BUY_DO_CANCEL;
                             break;
                
            case SELL_ORDER: state = ORD_SELL_DO_CANCEL;
                             break;           
          } 
          SetTransCount( true );
        }
        else
        {
          mem_magic = 0;
          mem_tick = 0;
          CheckError( result.retcode, "Remove: Результат удаления ордера не верен! Причина: ", order_status, ticket );
        }  
      }
      else
      {
        mem_magic = 0;
        mem_tick = 0;
        CheckError( result.retcode, "Remove: Ордер не отослан! Причина: ", order_status, ticket );
      }
    }
    else
    {
      ticket = 0;
      modify_count = 0;
    }
  }
  else
  {
    modify_count = 0;
  }
}

How can there be a wrong request if the order is ACTIVE?

2015.09.15 15:27:31.402 Trades  'xxxxx': failed modify order #20619541 sell limit 35.00 BR-11.15 at 50.33000 sl: 0.00000 tp: 0.00000 -> 49.19000, sl: 0.00000 tp: 0.00000 [Invalid request]
2015.09.15 15:27:32.611 Trades  'xxxxx': failed cancel order #20619541 sell limit 35.00 BR-11.15 at 50.33000 [Invalid request]
2015.09.15 15:27:34.163 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:42.815 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:43.006 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:43.358 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:43.407 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:44.562 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:44.572 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:45.593 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:45.892 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:47.007 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:47.407 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:47.769 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:47.789 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:50.819 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:50.879 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:27:50.900 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:28:04.330 Trades  'xxxxx': failed cancel order #20619543 buy limit 50.00 BR-11.15 at 48.29000 [Invalid request]
2015.09.15 15:28:04.330 Trades  'xxxxx': failed cancel order #20619541 sell limit 35.00 BR-11.15 at 50.33000 [Invalid request]
 

The constant editing of the post has started again. As if that makes the topic more visible to the developers.

You'd be better off in the Service Desk rubbing them every day instead of updating the forum with invisible updates...

 
Andrey Khatimlianskii:

The constant editing of the post has started again. As if that makes the topic more visible to the developers.

You'd better rub them in the service-desk every day instead of updating the forum with invisible updates...

Good morning, Andrew!

No one is answering there either (everyone is "fed up").

 
And here, the community will be aware of the current problems.
 

Are you, Andrei, against fixing bugs in MT5 and

Are you against fixing bugs in MT5 and improving the trading functionality of the platform?

Reason: