Why do I keep getting Error 130??

 

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()
  {
//---
   Alert("");

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

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.

 

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.

Reason: