MarketInfo MODE_STOPLEVEL = 0.00 + OrderSend Error 130

 

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

 
https://forum.mql4.com/36571#390355
 
Try sending the order with Sl and Tp equal Zero. If that works then use order-modify to set Sl and Tp.
 

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);

 
Take a look here: http://crum.be/ecn and here: http://crum.be/45digit
 

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());
     */
 
ubzen:
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, 

 
Why couldn't I put in single one ordersend logic? Because the system wouldn't allow you. Times are changing and most brokers are going to ECN instead of Dealing-Desk. ECN does-not allow Sl and Tp sending with order.
 
hftsang:


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?

If you have the same problem why didn't you read any of the previous answers ?
 
hftsang: The coding makes so clumsy. 
Did you look at the code I posted just above your comment? I showed how it's done in four statements.