What is MT4 Error 131?
The MT4 error 131 is an invalid volume OrderSend error code. It suggests that your Expert Advisor (EA) sends an order with an inappropriate trade volume to your broker’s server.
This error code may frequently appear during testing an MT4 EA, especially when there is an issue with the volume settings of your trading robot. Otherwise, it may happen due to a coding error of the expert advisor.
The biggest problem with the OrderSend error 131 is it entirely disables your trading bot from executing backtests and fresh orders. It may happen for both paid and open-source EAs, because most of the time, it occurs due to a mismatch of volume calculation methods between the EA and the serving brokers.
So, your trading platform showing an error 131 doesn’t necessarily mean you need to abandon your EA or the broker. If there is a problem with the bot’s programming, you might need a few edits with the coding. Otherwise, you may check the volume settings of your expert advisor and fix the issue by only making a few changes.
In this guide, we explain the possible scenarios of encountering the error 131. Also, we discuss a couple of solutions for getting rid of the invalid volume OrderSend problem from your MT4 platform.
Why does MT4 error 131 happen?
An MT4 error 131 may happen due to the following reasons:
The EA is using an inappropriate volume figure
Most EAs calculate a trading volume based on the risk percentage, which is entirely acceptable and fair. But the problem occurs when the calculated figure comes with more than two digits. For instance, if it is a 0.01 or 0.11 lot, then there is no problem. But if it sends an order with a volume like 0.111 or 0.245, it’ll show the error code 131.
Issues with the volume settings
How your broker recognizes a trading volume may differ depending on your trading account types. Suppose your EA is configured for a micro account, and you’re using it for a standard account. In this case, your broker may read a 0.01 lot as 0.001, considering the figure is less than the minimum order limit. As a result, the order becomes invalid, and the system shows the same OrderSend error.
How to fix MT4 error 131?
Time needed: 5 minutes.
How to fix MT4 Invalid Volume OrderSend errors
- Adjust the volume settings
If your broker fails to define the trading volume correctly, then insert the following codes to reset your volume settings:
MODE_LOTSIZE – It determines the number of units an EA will consider to count as one standard lot. Typically, a standard-size lot equals 100,000 units.
MODE_MINLOT – The minimum amount of trading volume you’ll use for executing an order. If your broker doesn’t accept 0.01 as the minimum lot size, consider replacing the value by 1.
MODE_LOTSTEP – It sets the step size of your trading volume.
MODE_MAXLOT – The maximum trading lot you can use for an order.
- Normalize the volume
Alternatively, you can try normalizing the volume configuration of the EA with the following lines of code:
This setting will keep the normalized volume lesser than the non-normalized value. For example, if the non-normalized volume is 0.1234, then the normalized volume will be 0.12.
Also, you may encounter the MT4 error 131 during backtesting an EA. In that case, simply go offline and then try backtesting again.