OrderSend always gives error 130...

 

Hi!


I'm starting with MQL4 programming and I've come across a problem. To reduce the problem, I've made a simple EA, with only 1 lines in the start() function:


OrderSend (Symbol(), OP_SELL, 0.1, Bid, 3, Bid+(Point*50), Bid-(Point*50));


It should place a market order every time there is a new tick, right?


Well, it doesn't; I keep getting error 130, Invalid stops all the time.


Another sentence:


OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-(Point*100),Bid+(Point*100));


is always giving error 130. Stops are not tight at all, as it's 100 pips (I've tried 50, and other values, with the same result).


I've even pasted an OrderSend sentence from one of the example EA's of MetaTrader, and it gets the 130 as well !!


What can be the problem? I don't know what else I can do!

 

Could be the broker you use does not allow stops to be set with the order.

If this is the case, you need to open the order with zeros in the OrderSend() and subsequently modify with OrderSelect() and OrderModify().

Check the return from MarketInfo(Symbol(),MODE_STOPLEVEL) to find out.


CB

 
pepribal:

Hi!


I'm starting with MQL4 programming and I've come across a problem. To reduce the problem, I've made a simple EA, with only 1 lines in the start() function:


OrderSend (Symbol(), OP_SELL, 0.1, Bid, 3, Bid+(Point*50), Bid-(Point*50));


It should place a market order every time there is a new tick, right?


Well, it doesn't; I keep getting error 130, Invalid stops all the time.


Another sentence:


OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-(Point*100),Bid+(Point*100));


is always giving error 130. Stops are not tight at all, as it's 100 pips (I've tried 50, and other values, with the same result).


I've even pasted an OrderSend sentence from one of the example EA's of MetaTrader, and it gets the 130 as well !!


What can be the problem? I don't know what else I can do!


I see two problem if your broker is using 5 digits. Your want 100 pips and slippage of 3 pips.

double pips2dbl = Point, pips2points=1;
if (Digits == 3 || Digits == 5) {pips2dbl *= 10.0; pips2points*=10;}
OrderSend(Symbol(),OP_BUY,0.1,Ask,3*pips2points,Bid-(pips2dbl*100),Bid+(pips2dbl*100));

 
gracias couldbraker, yo tenia el mismo problema...me volvi loco
completando con Zeros, lo solucione!
 

I think the slip is too small!

change 3 to 30,and try.

Reason: