OrderSend problen (not solved)

 

Hi everyone!

i saw some topic like this without any answer and i made this topic to find at least one answer

i used this code for send a simple order


MqlTradeRequest request={0};
   MqlTradeResult  result={0};   
   request.symbol = _Symbol;                                        
   request.action = TRADE_ACTION_PENDING;                             
   request.type = ORDER_TYPE_BUY_LIMIT;                               
   request.volume = 100.00;                                           
   request.price = 16028;
   request.sl=0;
   request.tp=0;
   request.magic = 0;                                       
   request.deviation=_Point;                                        
   request.type_time=ORDER_TIME_GTC;
   request.stoplimit = 0;
   request.comment ="";
   request.type_filling = ORDER_FILLING_RETURN;                         

     OrderSend(request,result);

but i get this error every time i tried


2019.08.05 11:51:53.257    Trades    '######': buy limit 100.00 ###### at 16028
2019.08.05 11:51:53.389    Trades    '######': accepted buy limit 100.00 ###### at 16028
2019.08.05 11:51:53.391    Trades    '######': rejected buy limit 100.00 ###### at 16028


do you know any solution for this problem?

thank you

 
Name of the trading server?
 
fxsaber:
Name of the trading server?
server name is "Mofid securities PJS"
 
ho2xsein:
server name is "Mofid securities PJS"
void OnStart()
{
  Print(AccountInfoInteger(ACCOUNT_TRADE_EXPERT)); // 0 - EA is disabled.
}
 
ho2xsein 2019.08.06 11:55 | 37.27.43.139 ban
fxsaber:

2019.08.06 09:16:32.086    test (######,D1)    1

log is 1


(Post accidentally deleted)


 
fxsaber:
do you know any way to solve it?
 
Deviation is already measured in points. If you assign _Point which is a double it will become 0 when assigned to the field. I'd set it to 10 or so and try again. And did you check GetLastError(), what's its value?
 
lippmaje:
Deviation is already measured in points. If you assign _Point which is a double it will become 0 when assigned to the field. I'd set it to 10 or so and try again. And did you check GetLastError(), what's its value?

Deviation is irrelevant for a pending order.

What need to be checked is result.retcode, GetLastError() will always return 4756 in case of trading error.

 
ho2xsein:
do you know any way to solve it?

Apparently the order was accepted by MT5 server but rejected by the external trading system.

Check the following symbol's properties : SYMBOL_FILLING_MODE (related to allowed order 'type_filling'), SYMBOL_EXPIRATION_MODE (related to allowed order 'type_time'), SYMBOL_ORDER_MODE (related to allowed order 'type').

If that doesn't help, you should talk to your broker.