Question about OrderSend and OrderModify

 

Hello -

I would like some clarification about OrderSend() and OrderModify() with regards to OCO tickets.

If I execute the following command:

EXAMPLE ------> ticket=OrderSend(1. Symbol(),

2. OP_BUY,

3. 1,

4. Ask,

5. 3,

6. Ask-25*Point,

7. Ask+25*Point,

8. "My order #2",

9. 16384,

10. 0,

11. Green);

Am I actually sending out 3 Orders (i.e. 1 order for the BUY, 1 order for SELLLIMIT @ Ask+25*Point, and 1 order for SELLSTOP @ Ask-25*Point) ?

If so, should I see all 3 orders in terminal with my magic number 16384?

Same question applies for OrderModify.

All / any help will be appreciated.

 
mathurpratik:
I would like some clarification about OrderSend() and OrderModify() with regards to OCO tickets.

Am I actually sending out 3 Orders (i.e. 1 order for the BUY, 1 order for SELLLIMIT @ Ask+25*Point, and 1 order for SELLSTOP @ Ask-25*Point) ?
If so, should I see all 3 orders in terminal with my magic number 16384?

Same question applies for OrderModify.
  1. The mql4 paradigm doesn't have OCO. The TP/SL is the corresponding.
  2. Yes, if your broker allows hedging. US brokers aren't allowed. Always check return codes so you find out why.
    int ticket = OrderSend(...)
    if (ticket < 0) Alert("OrderSend(buy) Failed: ", GetLastError());
    Also you must adjust for 5 digit brokers, TP, SL, AND slippage. On a 5 digit broker 25*point is 2.5 pips and is probably too small. Minimum is MarketInfo(Symbol(), MODE_STOPLEVEL)*Point. On IBFX it's 3 pips, 30 points.
    //++++ 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 == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    
    On ECN brokers you must open first and THEN set stops.
  3. What you have is what you can modify.