very simple OrderSend question

 

I have a very simple problem, or I hope it is. I cannot believe that this code is not working:

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,"",0,0,Green);

I guarantee that the condition triggering this trade request works perfectly, but I am simply unable to create a market buy order.

Do you have any Idea what could be wrong with this OrderSend?

 
Mom_markets:

I have a very simple problem, or I hope it is. I cannot believe that this code is not working:

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,"",0,0,Green);

I guarantee that the condition triggering this trade request works perfectly, but I am simply unable to create a market buy order.

Do you have any Idea what could be wrong with this OrderSend?

Try to use smaller lot size
ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"",0,0,Green);
 

Yes, that worked. Oh my goodness, I really danced around that solution for a long time without landing on it. Yikes, what a day.

Thank you for your help.

 
Mom_markets:

I have a very simple problem, or I hope it is. I cannot believe that this code is not working:

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,"",0,0,Green);

I guarantee that the condition triggering this trade request works perfectly, but I am simply unable to create a market buy order.

Do you have any Idea what could be wrong with this OrderSend?


not only smaller lotsize, also the slippage is here if you have a 5 digit broker is too low. (3 points = 0.00003)

This way you can get very often requote. This command is for 4 digit brokers 3 pips (3 pips = 0.0003)

So make it for 5 digit brokers

ticket=OrderSend(Symbol(),OP_BUY,0.01,Ask,30,0,0,"",0,0,Green);
 
Always test your return codes so you know WHY it didn't work. Always 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.015      0.0150
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.
    /* 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: