Still stymied by error 130

 

MarketInfo(Symbol(), STOP_LEVEL) returns 30

Bid = 1.3231

My simple Sell order: open = 1.3231, stop-loss = 1.3264, take-profit = 1.3141

(my stop-loss is 33 pips above my open price, and my take-profit is 90 pips below it)

Still I receive error 130 "invalid stops". And not just once, but repeatedly.

HELP Please!

Lee

 

Is your Broker an ECN Broker ?

ECN

 
leecallen:

MarketInfo(Symbol(), STOP_LEVEL) returns 30

Bid = 1.3231

My simple Sell order: open = 1.3231, stop-loss = 1.3264, take-profit = 1.3141

(my stop-loss is 33 pips above my open price, and my take-profit is 90 pips below it)

Still I receive error 130 "invalid stops". And not just once, but repeatedly.

The way to fix this is to reduce the problem. Leave SL and TP as 0 and make sure that works. Then put in SL and get that to work. Finally put TP back in.
 
leecallen:

MarketInfo(Symbol(), STOP_LEVEL) returns 30

Bid = 1.3231

My simple Sell order: open = 1.3231, stop-loss = 1.3264, take-profit = 1.3141

(my stop-loss is 33 pips above my open price, and my take-profit is 90 pips below it)

Still I receive error 130 "invalid stops". And not just once, but repeatedly.

  1. POST THE CODE. No mind readers here.
  2. Why did you open this second post when you already had one open? DON'T DOUBLE POST
  3. You said StopLevel is 30. Are you on a 4 or 5 digit broker? That means 30 or 3 pips depending. I think you are on a 5 digit broker.
  4. You open a sell at the Bid, your stops must be relative to the ASK. Your SL is NOT 33 pips above, it is 33 - the spread above. What is the spread.
  5. On a ECN broker you must open first and then set stops.
    //++++ These are adjusted for 5 digit brokers.
    int     pips2points;    // slippage  3 pips    3=points    30=points
    double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){                                                     OptParameters();
         if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345
                    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(..., 0,0,...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else if (!OrderSelect(ticket, SELECT_BY_TICKET))
           Alert("OrderSelect failed: ", GetLastError());
        else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)
           Alert("OrderModify failed: ", GetLastError());
         */
    

Reason: