Error Msg 138

 
When running my EA on MT4 Demo account, it seems to only trade in one direction when backtesting. In the journal it shows the Buys and Sells, but the Sells show an error 138. What does this mean and how do I fix it?
 
123jvansloten:
When running my EA on MT4 Demo account, it seems to only trade in one direction when backtesting. In the journal it shows the Buys and Sells, but the Sells show an error 138. What does this mean and how do I fix it?
Mql4 Error 138 Requote
Error 138 means that the broker replied with a "Requote" signal to your expert advisor's OrderSend() function call. In other words, the price used in the order is outdated compared to the current market price.
 
123jvansloten :
When running my EA on MT4 Demo account , it seems to only trade in one direction when backtesting. In the journal it shows the Buys and Sells, but the Sells show an error 138. What does this mean and how do I fix it?

You are probably trying to sell at ask price in your code.

 
123jvansloten: When running my EA on MT4 Demo account, it seems to only trade in one direction when backtesting. In the journal it shows the Buys and Sells, but the Sells show an error 138. What does this mean and how do I fix it?

You are probably using the wrong open price to place the orders.

  • A "buy" position opens at the Ask price and closes at the Bid price.
  • A "sell" position opens at the Bid price and closes at the Ask price.

Reason: