Why do I keep getting Error 130??

To add comments, please log in or register

Hi. So I just started learning MQL4 and was testing if I could send order at Ask price on USDJPY.

However, whenever I try to run the program on MT4, I keep on getting "Error 130", although I set SL/TP far apart from Ask price. 

Why is this happening??

void OnStart()

   int orderID = OrderSend(NULL,OP_BUYLIMIT,0.01,Ask,10,105.109,109.261);
   if(orderID < 0) Alert("order rejected. Order error: " + GetLastError());
Keith Watford
Keith Watford  

You cannot (usually) place a buy limit at ask.

In future please post in the correct section

I will move this topic to the MQL4 and Metatrader 4 section.

William Roeder
William Roeder  

You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
          Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

On some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs.

To add comments, please log in or register