If you are an MQL5 programmer or a forex trader trading on MetaTrader 5 you will encounter an error ‘Error 4756’ (ERR_TRADE_SEND_FAILED). It appears during testing your Expert Advisor (EA bot) on the MT5 strategy tester or MT5 Demo Account you may also find errors like as:
Trade Request Sending Failed
failed instant buy 0.01 EURUSD at 1.05399 sl: 1.05399 tp: 1.05389 [Invalid stops]
Sending negotiation request failed
failed instant sell 0.01 EURUSD at 1.05399 sl: 1.05399 tp: 1.05389 [Invalid stops]
In order to get rid of these errors you mainly need to check the following:
- Lot size
- Stop loss
- Takeprofit
To resolve this error, ensure you have entered a valid lot size, which must not be less than the minimum lot size allowed by the MT5 broker and rounded off to the correct decimal place. You should also check the stop loss and take profit values, they must not be too close to the market price, if error 4756 is still there keep on increasing sl and tp until the error is resolved.
In this article, we will discuss error #4756 from both perspectives; as an MT5 forex trader and an MQL5 programmer.
What to take care of if you are a forex trader?
While trying to place an order on Metatrader 5 either manually or automatically via MT5 Expert Advisor (EA bot), you may face error 4756. This error will occur when sending a negotiation request failed because of any of the following reasons:
- Invalid lot size
- Invalid stop loss
- Invalid take profit
- No price
Invalid lot size
While you are trying to place an order on your Metatrader 5 with the lot size not allowed by the broker, or the lot size too low or too high. In case you are trying to open the trade with a lot size too low kindly try to increase the lot size. If you have set the lot size of your order too high with a low deposit try to reduce the lot size. Another reason for an invalid lot size could be your lot size not rounded off properly when you are trying to open the trade on MT5 manually or with MT5 Expert Advisor (EA bot) while automated trading on MetaTrader 5. In this scenario, ensure it is rounded off to the correct decimal place allowed by the broker. In this way, you can avoid trade request sending failed or error #4756.
Invalid stop loss
You may also face the error [Invalid stops] while trading on MetaTrader 5 either manually or with an mql5 expert advisor because of invalid stop loss. In this case, you may see the following errors
Sending negotiation request failed
failed instant buy 0.01 EURUSD at 1.05399 sl: 1.05399 tp: 1.05389 [Invalid stops]
Trade Request Sending Failed
failed instant sell 0.01 EURUSD at 1.05399 sl: 1.05399 tp: 1.05389 [Invalid stops]
In this scenario you need to check your stop loss price, it should not be too close to the market price when you are trying to open the order. To avoid Sending a negotiation request failed or a Trade request sending a failed error you need to keep on increasing the stop loss until you no longer receive error 4756 or error [Invalid stops].
Invalid take profit
Another reason that may cause error 4756 (ERR_TRADE_SEND_FAILED) also known as an error [Invalid stops] on MetaTrader 5 is invalid take profit. Trade request sending failed error may occur if you are trying to set the take-profit of your order on MT5 too close to the price resulting in an error [Invalid stops]. To get rid of error [Invalid stops] or error Sending negotiation request failed, keep on increasing the take profit of your order until there is no error 4756.
No price
You may also face error 4756 while trading with MQL5 Expert Advisor (EA bot) if your MQL5 Expert Advisor is trying to open the order on the forex symbol which is not enabled in the symbol list. After the error occurs the symbol automatically gets enabled.
What to take care of if you are an MQL5 programmer?
If you are an MQL5 programmer creating MT5 Expert Advisors (EA bots) for automated forex trading on MetaTrader 5 you may also face error 4756 (ERR_TRADE_SEND_FAILED), Sending negotiation request failed or Trade request sending failed error. To tackle this error you need to check your mql5 code either you have handled the lot size, stop loss, take profit, and price of the Expert Advisor correctly or not. Here are a few suggestions to take care of:
- Adjust lot size properly
- It should not be less than the minimum lot size allowed by the MT5 broker.
- The lot size should be properly normalized to the correct decimal place. You may refer to SymbolInfoDouble (Symbol(), SYMBOL_VOLUME_STEP).
- Adjust sl and tp properly:
- Make sure that sl and tp are not set between the Ask and Bid price.
- Make sure that sl and tp are not too close to the market price.
Being a programmer you need to study MqlTradeRequest and MqlTradeResult and the values they are fetching and passing to the OrderSend function are valid ones so that you may avoid OrderSend errors.
We hope that this blog has been helpful in resolving the ERR_TRADE_SEND_FAILED for our MT5 traders and MQL5 programmers. The Expert Advisors created by 4xPiP efficiently handle this error [Invalid stops] or Trade Request Sending Failed in MT5, by implementing smart exception handling and calculating the valid stop-loss limit and takeprofit limit for the trade even if the trader has entered the invalid stops.
If you are worried about how to resolve ERR_TRADE_SEND_FAILED in MQL5, contact our support team.
🔎For more information https://4xpip.com/book-appointment
🔎For programming your bot https://4xpip.com/custom-bots