reason for error 4756

 

Hi all, I'm trying to open a sell stop order with the following parameters

      request_3.action=TRADE_ACTION_PENDING; 
      request_3.type=ORDER_TYPE_SELL_STOP;  
      request_3.price=Entry_Price; 
      request_3.magic=1 ;                     
      request_3.symbol=_Symbol;               
      request_3.volume=Get_Size(0,Risk,Distanza_Short);            
      request_3.sl=Stop_Short;                 
      request_3.tp=0;  
      request_3.comment="Trigger 1";
      request_3.type_time=ORDER_TIME_DAY;

but I have error 4756.

If I try to place the stop order manually with same price and stop used by the expert, then the order is excecuted.

I verified entry price and stop respect the stop level,

Could you suggest how to investigate the reaosn of the error?

Thank you

 
Check   SYMBOL_TRADE_FREEZE_LEVEL in this article.
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
To obtain the current market information there are several functions: SymbolInfoInteger() , SymbolInfoDouble() and SymbolInfoString() . The first...
 

Thank you for the answer.

I tried with

Print(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_FREEZE_LEVEL)) ; 

but the result is zero.

 
Alberto Tortella #:
SYMBOL_TRADE_FREEZE_LEVEL
Print(SYMBOL_TRADE_FREEZE_LEVEL) ; 

This is the way you should use it. It is points value. Check the article.

Type of order/position
Activation price
Check
Buy Limit order
 Ask
Ask-OpenPrice >= SYMBOL_TRADE_FREEZE_LEVEL
Buy Stop order  Ask OpenPrice-Ask >= SYMBOL_TRADE_FREEZE_LEVEL
Sell Limit order  Bid OpenPrice-Bid >= SYMBOL_TRADE_FREEZE_LEVEL
Sell Stop order  Bid Bid-OpenPrice >= SYMBOL_TRADE_FREEZE_LEVEL
Buy position
 Bid TakeProfit-Bid >= SYMBOL_TRADE_FREEZE_LEVEL
Bid-StopLoss >= SYMBOL_TRADE_FREEZE_LEVEL
Sell position
 Ask Ask-TakeProfit >= SYMBOL_TRADE_FREEZE_LEVEL
StopLoss-Ask >= SYMBOL_TRADE_FREEZE_LEVEL
The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
Reason: