OrderSend Error 3

Sometimes you would get an OrderSend Error 3 message in your experts log in MetaTrader 4. This can be a rather frustrating error because it prevents the order from executing (and position from opening). If you are an MQL coder you should learn how to fix it because it signifies that there is error in the logic of your expert advisor. If you are a simple Forex trader then there are some simple steps that you can do to fix this error if you have an .mq4 file of the EA. Here you’ll find out why OrderSend Error 3 occurs and how to fix it in MetaTrader.
The OrderSend Error 3 is called ERR_INVALID_TRADE_PARAMETERS internally in MT4 platform. ERR_INVALID_TRADE_PARAMETERS means that some of the parameters passed to OrderSend() function aren’t correct. By the way, this error may also appear with OrderModify() function (appears as OrderModify Error 3). The most popular cases are the following:

  • Incorrect operation type passed to OrderSend() function. Remember that there are only 6 operation types available in MetaTrader.
  • Negative slippage passed to OrderSend() function. Remember that slippage can only be 0 or greater.
  • Incorrect order ticket number passed to OrderModify() function. Make sure the order with the given ticket number exists in the system before using this function.
  • So what to do when you spot this OrderSend Error 3? First, check that the operation passed to the function is one of the following:

  • OP_BUY (Open long position).
  • OP_SELL (Open short position).
  • OP_BUYLIMIT (Buy limit order).
  • OP_SELLLIMIT (Sell limit order).
  • OP_BUYSTOP (Buy stop order).
  • OP_SELLSTOP (Sell stop order).
  • Then make sure that the slippage passed to the OrderSend() function isn’t negative. Slippage is often given as an input parameter, so you just enter some positive value there. Finally, if the error appears as OrderModify Error 3, make sure that the EA deals with the correct ticket number (maybe it’s trying to use 0 or -1). Just add this condition in front of the OrderModify() function in .mq4 file of the expert advisor:
    if (ticket > 0)
    where “ticket” is your variable for ticket number used in the function. It will cut all attempts to pass the most popular incorrect ticket numbers.

    If you have any thoughts, comments or questions regarding MT4 Error 3 and the ways to treat it, feel free to reply to this post using the form below.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    eleven + = thirteen