Errors, bugs, questions - page 733

 
now checked - the other sound events don't work either.
 

I see a strange situation in operation of methods for position opening in CTrade class (PositionOpen,Buy,Sell) - the Expert Advisor actually opens a position (I can see it in the terminal), but these methods return false, _LastError=4756 (failed to send a trade request). While CTrade.ResultRetcode()=10008 (Order placed).

Am I missing something in the operation of Alpari servers these days or is it a bug?

 
blef:

now checked - other sound events aren't working either.

Are the sounds in the terminal enabled?

 
Yes - enabled, same thing happens on the ROBOFOREX server.
 
now all sound events are working ==> on both MQ and ROBOFOREX terminals.
 

I create an EA, I run it on a chart and open a position manually:

void OnTrade()
  {
//---
   if(OrdersTotal()!=0)
     {
      OrderSelect(OrderGetTicket(0));
      Print("Есть ордера OrdersTotal()=",OrdersTotal()," ",
            EnumToString((ENUM_ORDER_STATE)OrderGetInteger(ORDER_STATE))
            );
     }
   else
     {
      OrderSelect(OrderGetTicket(0));
      Print("Нет ордеров OrdersTotal()=",OrdersTotal()," ",
            EnumToString((ENUM_ORDER_STATE)OrderGetInteger(ORDER_STATE))
            );
     }
  }

I run the EA on a chart, manually open a position and get in the prints:

2012.05.02 16:27:10     Template Trades (EURUSD,M15)    Нет ордеров OrdersTotal()=0 ORDER_STATE_STARTED
2012.05.02 16:27:10     Template Trades (EURUSD,M15)    Нет ордеров OrdersTotal()=0 ORDER_STATE_STARTED
2012.05.02 16:27:10     Template Trades (EURUSD,M15)    Нет ордеров OrdersTotal()=0 ORDER_STATE_STARTED

How is it possible that I get a "trader" event but no orders, but I get "no orders" type started and always.

I think this shit just doesn't work.

 
And you check the result of the execution
OrderSelect(OrderGetTicket(0));

What is the point of asking for the status of a non-existent order? And what will the second form return in that case?

bool  OrderGetInteger(
   ENUM_ORDER_PROPERTY_INTEGER  property_id, // идентификатор свойства
   long&                long_var          // сюда примем значение свойства
   );
 
Rosh:

And you check the result of execution

What is the point of asking for the status of a non-existent order? And what will the second form return in this case?

I knew you would go down this road of code parsing.

And why don't you care if there is an order, since the trader event has triggered (at least one of them must be to set an order), and OrdersTotal() says that there is no order?

 
Urain:

I knew you would go down this road of code parsing.

And why don't you care if there is an order, since the trades event has triggered (at least one of them must be by order setting), but OrdersTotal() says that there are no orders?

Maybe PositionTotal() is needed?
 

This is the error that was displayed when the classes were connected

Silver closed fine, but gold did not.

Если проблема в проскальзывании, то не подскажите как его задавать?
if (myposition.Select(_Symbol))
{
 // закрыть открытую позицию по этому символу
 // величина проскальзывания была установлена ранее 
 mytrade.PositionClose(_Symbol);
}