Replace
OrderSend(SYMBOL_MAIN,OP_SELL,0.1,Bid,30,NormalizeDouble(Bid + 15* Point, Digits),NormalizeDouble(Bid - 15* Point, Digits),"Comment",MAGICMA,0,Red);
to
OrderSend(SYMBOL_MAIN,OP_SELL,0.1,Bid,30,NormalizeDouble(Bid + 150* Point, Digits),NormalizeDouble(Bid - 150* Point, Digits),"Comment",MAGICMA,0,Red);
Thank you very much.
It seems to work now. It was the simple 5 digits problem.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_POS)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket()...) Alert("OrderModify failed: ", GetLastError()); */
Try sending the order with Sl and Tp equal Zero. If that works then use order-modify to set Sl and Tp.
I seemed to have the same problem. My previous MT4 program has been working very well using a market buy/sell order with stoploss and take profit but now it was in error #130. I am sure that my stoploss/takeprofit were correct because it worked before. Also I was trading in crude oil futures so no problem of 4/5 digits in FX. Moreover, my takeprofit is set to be zero (i.e. no take profit) and the stoploss is set to 100 points outside.
How come I had to do an ordersend without SL/TP parameters and then modify the order. The coding makes so clumsy. Why couldn't I put in single one ordersend logic?
Assistance from any experienced will be very appreciated.
Regards,
How come I had to do an ordersend without SL/TP parameters and then modify the order. The coding makes so clumsy. Why couldn't I put in single one ordersend logic?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
my Broker (ECN) allows scalping. So, I get this Info for MarketInfo MODE_STOPLEVEL: 0.00. It is a 5 digits Broker.
BUT when sending orders I get the very known error message: OrderSend Error 130.
These are my Commands:
OrderSend(SYMBOL_MAIN,OP_SELL,0.1,Bid,30,NormalizeDouble(Bid + 15* Point, Digits),NormalizeDouble(Bid - 15* Point, Digits),"Comment",MAGICMA,0,Red);
OrderSend(SYMBOL_MAIN,OP_BUY,0.1,Ask,30,NormalizeDouble(Ask - 15* Point, Digits),NormalizeDouble(Ask + 15* Point, Digits),"Comment",MAGICMA,0,Green);
If I decrease the Stoploss from 15 to 10 then I get the OrderSend Error 130 though MODE_STOPLEVEL = 0.00.
Hope, you can help me.
Thanks,
Alex