OrderSend Error 148
OrderSend Error 148 or ERR_TRADE_TOO_MANY_ORDERS can be a rather frequent MetaTrader 4 error message, especially if you are trading on some demo/real contest account. The error means that you are trying to place an order or open a position when the maximum amount has already been reached. Some Fore brokers limit the number of simultaneously open orders and positions (usually, not counting the stop-loss and take-profit orders). When the maximum has already been reached and your MT4 expert advisor sends a new order request (pending or market) you will get a ”OrderSend Error 148″ message in the Experts log of your platform; the order won’t be executed.
As an MQL coder you should handle these situations properly as they obviously lead to the incorrect functioning of the EA. Your expert advisor should be checking the maximum allowed amount of orders and try not to open new ones if the maximum is reached; alternatively it can try closing previous orders if a new order is to be opened. The amount of orders should be checked with OrdersTotal() function. There is no MT4 function to find out the maximum allowed amount of orders, so you’ll have to consult your Forex broker for that.
Unfortunately, there is no easy way to fix OrderSend Error 148 if you are trader that doesn’t know how to code in MQL. In this case your solution could probably be to ask your Forex broker to increase the limit, but that’s quite unlikely to happen. Of course, there is no point in doing this if your EA tends to open infinite number of orders. In that case it’s better to ask some coder (on a Forex forum, for example) to fix the expert advisor.