FORTS: OnTradeTransaction() return codes - page 6

 

Awesome!

Installation time - 15:07:31.849

Time of removal - 15:07:31.865

And it's already 25th week ofInvalid request, and it's in all seriousness. Now I understand why servicedesk is silent.


 

In which cases the advisor may receive a code:

TRADE_RETCODE_REJECT
 

Sergei!

You turned out to be right. MQ bug

Theterminal does not update the order status:

2015.11.26 15:41:56.094 Forts_trader (GAZR-12.15,H1)    Remove: Ордер не отослан! Причина: Неправильный запрос; Билет = 24041883
2015.11.26 15:41:56.094 Forts_trader (GAZR-12.15,H1)    DEBUG: order state = ORDER_STATE_STARTED
2015.11.26 15:41:56.068 Forts_trader (GAZR-12.15,H1)    CheckOrders: Sell ордер установлен. Билет = 24041883

I received an order but its state is stillORDER_STATE_STARTED

 
Михаил:

Sergei!

You turned out to be right. MQ bug

Theterminal does not update the order status:

I have received the order but its state is stillORDER_STATE_STARTED

Michael, does the order still exist after these messages? By any chance a deal could not have been executed on it a few ms before?

 
Alexey Kozitsyn:

Michael, does the order still exist after these messages? Was it, by any chance, a few ms before that the trade could not have been executed?

Yes, the order still exists after the error.

It does not matter, because before deleting (modifying) the order is checked if it exists:

void COrder::Remove()
{
  if ( ticket > 0 )
  {
    if ( OrderSelect( ticket ) )
    {
      ENUM_ORDER_STATE ord_state = ENUM_ORDER_STATE( OrderGetInteger( ORDER_STATE ) );
      if ( ( ord_state == ORDER_STATE_REQUEST_MODIFY ) ||
           ( ord_state == ORDER_STATE_REQUEST_CANCEL ) ||
           ( ord_state == ORDER_STATE_REQUEST_ADD ) ) return;
//........................................ Other code 
   }
  }
}
 

Why I ask, I have this situation:

Logbook (experts):

2015.11.26 18:05:16.725 FROG (RTS-12.15,M1)     TradeRemoveCycle case ORDER_STATE_PLACED: ОШИБКА #4756,  retcode = 10013. Ордер не удален!
2015.11.26 18:05:16.691 FROG (RTS-12.15,M1)     TradeRemoveCycle: ORDER_STATE_PLACED

I can see that the order has been accepted (which means it can be handled), but the request is not correct.

In the logbook the log is like this:

2015.11.26 18:05:16.725 Trades  '1007642': failed cancel order #35817112 buy 0.00  at market [Invalid request]
2015.11.26 18:05:16.693 Trades  '1007642': cancel order #35817112 buy limit 1.00 RTS-12.15 at 87780
2015.11.26 18:05:16.691 Trades  '1007642': deal #4375646 buy 1.00 RTS-12.15 at 87780 done (based on order #35817112)

I.e. at the moment the order was deleted, a deal was executed on it. And then, the robot is trying to delete the order which does not exist any more.

Now I'm trying to decide what to do.

 
Михаил:

Yes, the order does exist after the error.

But it doesn't matter, because before deleting (modifying) the order is checked that it exists:

As you can see, mine does too...
 
Alexey Kozitsyn:

Why I ask, I have this situation:

Logbook (experts):

I can see that the order has been accepted (which means it can be handled), but the request is not correct.

In the logbook the log is like this:

I.e. at the moment the order was deleted, a deal was executed on it. And then, the robot is trying to delete the order that does not exist anymore.

Now I am trying to decide what to do.

I have also had this problem, but I have solved it.

What command do you use to set the OrderSend() or OrderSendAsync()?

 
Михаил:

I've had this problem too, but I've solved it.

Which command do you use to set OrderSend() or OrderSendAsync()?

OrderSend(). And what is the difference in this case?
 
Alexey Kozitsyn:
OrderSend()

The thing is that when an order is being executed, you don't control its execution and therefore you don't block OnTick() or OnBookEvent().

You need to handle the trade event in OnTradeTransaction() to quickly control the order being executed.

I will post the code on how to do it soon...

Reason: