problem with order send.

 

Hi, I have a little problem when I send my order in the EA. This order not works properly in all kinds of markets, the order however works fine on the EUR/USD. I need to change any part of the order to work properly in other markets than the EUR/USD? May be I need put the stoplosss or the take profit in the 20.0 or 30.0 form and not in the 20 or 30 form?

OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask - StopLoss * Point,Ask + TakeProfit * Point,"My order #1",MagicNumber,0,Green);

Thanks.

 
  1. You can not place stops closer than MarketInfo(chart.symbol, MODE_STOPLEVEL)*Point (Was 3 pips/30 points on IBFX)
  2. You must adjust for 4/5 digit brokers (TP, SL, AND slippage)
  3. On ECN brokers you must open first and THEN set stops.
  4. Always test your return codes so you find out WHY.
From my code
//++++ 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 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(..., 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());
     */