OrderSend Issue

 

This seems way to simple but I'm missing something and its only changed recently

This used to work a couple of weeks ago:

OrderSend(Symbol(),OP_BUY,1,Ask,5,Ask-25*Point,Ask+35*Point);

Now it doesnt but if I change it to 0 stoploss and 0 take profit it does work:

OrderSend(Symbol(),OP_BUY,1,Ask,5,0,0);

Any ideas?

full code is:

int init()
{
//----

OrderSend(Symbol(),OP_BUY,1,Ask,5,0,0);
OrderSend(Symbol(),OP_BUY,1,Ask,5,Ask-25*Point,Ask+35*Point);

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----


//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+

 
dmanning:
This used to work a couple of weeks ago:
Now it doesnt but if I change it to 0 stoploss and 0 take profit it does work:

  1. Your broker may have changed to ECN thus you need
        // 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());
    
    Always test your return codes and find out WHY
  2. EA's must also adjust for 4/5 digit brokers - TP, SL, AND slippage
    //++++ 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 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.
    
    Your 25*point may now be 2.5 pips and the minimum 3.0 MarketInfo(Symbol(), MODE_STOPLEVEL)*Point