Blog / Fix MT5 errors · Trade errors · MQL5
MT5 Error 4756: What It Means and How to Fix It
Learn what MT5 error 4756 means, how to identify the underlying trade request failure, and how to troubleshoot it in MQL5.
· 8 min read
What Is MT5 Error 4756?
MT5 error 4756 (ERR_TRADE_SEND_FAILED) means MetaTrader failed to send a trade request successfully.
It can appear when an Expert Advisor attempts to open, modify or close a position but the request cannot be completed.
The important detail is that 4756 does not identify the underlying reason for the failure. The actual problem may involve invalid trade parameters, insufficient margin, outdated prices, an unsupported filling mode or a trading restriction.
Changing random EA settings or repeatedly resending the order will not necessarily fix it. You first need to identify the trade server's response.
1. Check the Experts and Journal Tabs
When error 4756 occurs, start by checking the information MetaTrader has recorded.
- Open MT5.
- Locate the Toolbox window at the bottom of the platform.
- Select the Experts tab and find the EA's error message.
- Check the Journal tab for additional terminal and trade-request information.
- Note the time of the error, the symbol being traded and any reported return codes.
If the EA only prints error 4756, its logging may be insufficient. You may need to add diagnostic statements to the source code to retrieve the more specific trade-server response.
2. Retrieve the Actual Trade Server Response
MT5 provides two different types of error information:
- Terminal error: A runtime error returned by
GetLastError(). Error 4756 belongs to this category. - Trade server return code: A more specific response describing how the server processed the request.
When an EA uses the standard CTrade class, you can retrieve the server response through ResultRetcode() and its description through ResultRetcodeDescription().
For example:
#include <Trade/Trade.mqh>
CTrade trade;
void OpenBuy(double lots)
{
ResetLastError();
bool sent = trade.Buy(lots, _Symbol);
int terminal_error = GetLastError();
PrintFormat(
"Buy request: %s | Terminal error: %d | Server retcode: %u | Description: %s",
sent ? "true" : "false",
terminal_error,
trade.ResultRetcode(),
trade.ResultRetcodeDescription()
);
}This example attempts to open a market Buy position using the requested volume on the current chart symbol.
After the request, the log displays:
- Whether the
CTrademethod returned true or false. - The terminal error code.
- The trade server's return code.
- The server's description of the result.
For example:
| Server return code | Meaning |
|---|---|
| 10004 | Requote |
| 10013 | Invalid trade request |
| 10014 | Invalid volume |
| 10015 | Invalid price |
| 10016 | Invalid stops |
| 10017 | Trading disabled |
| 10018 | Market closed |
| 10019 | Insufficient money |
| 10020 | Price changed |
| 10021 | No available quotes |
| 10030 | Invalid filling mode |
| 10031 | No connection to trade server |
These codes point to different problems, so the correct fix depends on the response.
Important: A true return from trade.Buy() does not guarantee that the position was opened. It indicates that the method passed its basic request checks. You must also inspect the server return code to determine the outcome.
For example, 10009 (TRADE_RETCODE_DONE) indicates successful completion, while 10010 (TRADE_RETCODE_DONE_PARTIAL) indicates partial execution.
3. Identify What Caused the Request to Fail
Once you have the server return code, investigate the corresponding problem instead of treating every occurrence of error 4756 the same way.
Invalid trade request parameters
An EA must provide valid information when submitting a trade request.
Depending on the operation, this may include:
- Trading symbol.
- Order type and action.
- Volume.
- Price.
- Stop-loss and take-profit levels.
- Filling policy.
For example, a volume that violates the broker's minimum, maximum or volume-step requirements can trigger TRADE_RETCODE_INVALID_VOLUME (10014). See lot size normalization in MT5.
Similarly, stop-loss or take-profit levels that violate the symbol's trading restrictions can trigger TRADE_RETCODE_INVALID_STOPS (10016), covered in stop level and freeze level explained.
What to check: Retrieve the symbol's trading specifications and compare them with the values supplied by the EA. Do not assume that parameters valid for one instrument will also work for another.
Insufficient free margin
An EA may request a position that requires more margin than the account can support.
This can happen when the lot size is too large, available free margin is low or existing positions are already consuming significant margin.
The server may return TRADE_RETCODE_NO_MONEY (10019). How to validate lot size before sending an order walks through the checks.
What to check: Review the requested volume and available free margin. MQL5 provides OrderCalcMargin() to estimate the margin required for a proposed operation.
Reducing the volume may resolve the issue, provided the resulting position still complies with the EA's risk limits and the broker's volume restrictions.
Invalid or outdated prices
A trade request can fail when it uses a price that is no longer valid or when the market moves before the request is processed.
For example, an EA may calculate an entry price using an earlier tick and submit the request after the market has moved.
Relevant server responses include:
10015— Invalid price.10020— Price changed.10004— Requote.10021— No available quotes.
What to check: Retrieve the latest market tick before preparing the request. Avoid relying on prices stored from an earlier calculation. For when to retry, see requotes, off quotes and invalid price.
Unsupported order filling mode
MT5 supports different filling policies, including Fill or Kill (FOK), Immediate or Cancel (IOC) and Return.
However, not every symbol or broker supports every filling policy.
If an EA submits a request using an unsupported mode, the server may return TRADE_RETCODE_INVALID_FILL (10030).
What to check: Retrieve or configure the filling policy supported by the symbol instead of assuming that one mode works across all instruments.
Market or trading restrictions
A request may also fail because trading is unavailable under the current conditions.
Possible server responses include:
10017— Trading disabled.10018— Market closed.10031— No connection to trade server.
What to check: Confirm that automated trading is enabled, the EA has permission to trade, the account permits the requested operation and the instrument is available for trading.
Repeatedly resending an order will not resolve a restriction that remains in place.
4. How to Fix MT5 Error 4756
Once you have identified the underlying cause, apply the corresponding correction.
Correct invalid trade parameters
Check the values supplied to the trade request before submitting it.
Verify that:
- The trading symbol exists and is available.
- The requested volume meets the minimum, maximum and volume-step requirements.
- Stop-loss and take-profit levels comply with the symbol's trading restrictions.
- The order type and request action are compatible.
- Required request fields are correctly populated.
For volume restrictions, retrieve SYMBOL_VOLUME_MIN, SYMBOL_VOLUME_MAX and SYMBOL_VOLUME_STEP dynamically rather than hardcoding assumptions.
Check available margin
If the server returns TRADE_RETCODE_NO_MONEY, review the requested lot size and available free margin.
Use OrderCalcMargin() to estimate the margin required for the proposed trade.
If the estimate is too high for the account's available funds, reduce the volume or reject the trade according to the EA's risk rules.
Do not automatically force the volume down to an arbitrary value without checking whether it still meets the strategy's risk requirements.
Refresh prices before sending orders
When a request fails because of an outdated or invalid price, retrieve the latest available tick using SymbolInfoTick().
MqlTick tick;
if(SymbolInfoTick(_Symbol, tick))
{
double ask = tick.ask;
double bid = tick.bid;
PrintFormat(
"Current Ask: %f | Current Bid: %f",
ask,
bid
);
}
else
{
Print(
"Unable to retrieve current market prices. Error: ",
GetLastError()
);
}For a market Buy request, the Ask price is relevant. For a market Sell request, the Bid price is relevant.
However, refreshing prices does not guarantee execution at the displayed price. Market conditions can change between retrieving a tick and processing the order.
Use a supported filling mode
If the server returns TRADE_RETCODE_INVALID_FILL, check the symbol's supported filling policies.
When using the CTrade class, MQL5 provides SetTypeFillingBySymbol() to configure the filling mode according to the symbol's settings.
#include <Trade/Trade.mqh>
CTrade trade;
int OnInit()
{
if(!trade.SetTypeFillingBySymbol(_Symbol))
{
Print("Unable to set filling mode for ", _Symbol);
return INIT_FAILED;
}
return INIT_SUCCEEDED;
}This helps prevent requests from being rejected because of an unsupported filling policy.
It does not resolve unrelated problems such as insufficient margin, invalid stops or market closures.
Check trading permissions and market availability
If the server reports that trading is disabled or the market is closed, review the account and symbol conditions.
Check that:
- Automated trading is enabled in the terminal.
- The EA is permitted to trade.
- The account has permission to perform the requested operation.
- The symbol is available for trading.
- The market is open for the instrument.
Do not keep resending a request while the underlying restriction remains in place.
5. Prevent Error 4756 with Pre-Trade Validation
Instead of waiting for a trade request to fail, an EA can validate its request before submission.
MQL5 provides OrderCheck() for this purpose. It checks a trade request and returns information about potential problems, including margin requirements and the request's return code.
For example:
MqlTradeRequest request = {};
MqlTradeCheckResult check = {};
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = 0.10;
request.type = ORDER_TYPE_BUY;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
request.type_filling = ORDER_FILLING_FOK;
ResetLastError();
if(!OrderCheck(request, check))
{
PrintFormat(
"Order check failed. Error: %d | Retcode: %u | Comment: %s",
GetLastError(),
check.retcode,
check.comment
);
return;
}
Print("Order check passed. Request is ready for submission.");The example demonstrates the structure of a basic market Buy request. The volume and filling mode are illustrative; they must be adapted to the symbol's specifications and account conditions.
A successful OrderCheck() does not guarantee that the trade will execute. Prices, market availability and account conditions can change before the server processes the request.
Other useful practices include:
- Log the symbol, volume, order type and server response for failed requests.
- Validate stop levels and volume before submitting orders.
- Retrieve current quotes rather than relying on outdated prices.
- Handle temporary errors differently from permanent request errors.
- Avoid repeatedly submitting an order without checking the previous request's outcome.
These practices make an EA easier to maintain and help prevent recurring trade-request failures.
6. Can PositionAlpha Help Fix MT5 EA Errors?
Troubleshooting an EA can become time-consuming, particularly when several functions interact or a problem is difficult to reproduce.
With PositionAlpha's Fix an EA, you paste or upload the EA and describe the problem. The AI returns the complete updated .mq4 or .mq5 file and explains the problems it found and each change it made. Compile the result in MetaEditor and test it in the Strategy Tester and on a demo account before you rely on it.
Conclusion
MT5 error 4756 (ERR_TRADE_SEND_FAILED) indicates that a trade request failed to send successfully, but it does not identify the underlying reason on its own.
The most effective troubleshooting approach is to inspect the terminal error, retrieve the trade server's return code and use that information to identify what went wrong.
Whether the problem involves invalid parameters, insufficient margin, outdated prices, unsupported filling modes or trading restrictions, the solution should address the specific cause rather than simply retrying the order.
By validating trade requests, checking server responses and maintaining useful error logs, developers can make their MQL5 Expert Advisors more reliable and easier to troubleshoot.
Build a bot from your idea
Describe your trading idea and the AI writes MT4 or MT5 code for you to review and test, with a plain-English explanation and setup steps. Your first bot is free.