OrderModify (ECN)
Results 1 to 9 of 9

Thread: OrderModify (ECN)

  1. #1
    I am only having a little trouble figuring out the best way to utilise OrderModify on an ECN broker.

    Basically, I place the order:
    ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,0,0,Test EA,16384,0,Green);

    Then another line have:
    OrderModify(ticket,OrderOpenPrice(),Ask-Point*StopLoss,Ask Point*TakeProfit,0,Green);

    But if the market is moving fast then the takeprofit and stoploss will not be put relative to the entry position, but rather be placed on the Ask at the time it's modified.

    I attempted the following:
    OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice ()-StageStopLoss,OrderOpenPrice() Stage*TakeProfit,0,Green);

    However that throws an error in the console and also doesn't accept the change order.

    Any thoughts? Thanks!

  2. #2
    OrderModify(ticket,0 ,OrderOpenPrice()-Stage *StopLoss,OrderOpenPrice() Poi nt*TakeProfit,0,CLR_NONE);

    The OpenPrice() you employed can only be used with Pending Orders. (Cant alter the OpenPrice of a Market Order) - Also I notice that you put Green in there - Do you really wish to see when the Modify occurred? It'll overwrite the NEWOrder Arrow.

  3. #3
    If I had been obvious, I am not certain.

    Basically, the OrderSend lineup is immediately followed by the OrderModify as the ECN I'm using does not allow me to place SL TP at precisely the exact same line.

    Thus, when the market is moving quickly it sets SL TP relative to the transferred ask price instead of the open price.

    I would like to place SL TP relative to the actual order opening price, therefore why I was utilizing OrderOpenPrice() at the OrderModify line.

    OrderModify is defined as:
    bool OrderModify(int ticket, double price, double stoploss, dual takeprofit, datetime expiration, colour arrow_color=CLR_NONE)

    so I must have:
    OrderModify(ticket, OrderOpenPrice(), lt;lt;stoploss relative to order open pricegt;gt;, lt;lt;takeprofit relative to order open pricegt;gt;, 0, CLR_NONE)

    What I Need to know is what I need to use between those lt;lt;gt;gt; at that line

  4. #4
    Again... The FIRST Openprice () is your issue (ONLY Pending orders permit the OpenPrice to be altered). I have ECN compatible code- This a working snippet:

    OrderModify(ticket,0,NormalizeDouble(OrderOpenPric e() (StopLoss*Stage),Digits),0,0,CLR_NONE); Also unless you used OrderSelect() that the OrderOpenPrice() has NO Value... - It is possible to do askprice=Ask; THEN do your OrderSend and OrderModify using the Variable askprice.

    Dual askprice=Ask;
    ticket=OrderSend(Symbol(),OP_BUY,Lo ts,askprice,Slippage,0,0,Test EA,16384,0,Green);
    // bool xbool = OrderSelect(ticket, SELECT_BY_TICKET); - optional in this case
    OrderModify(ticket,0,askprice-Point*StopLoss,askprice Stage*TakeProfit ,0,CLR_NONE);

    in case you'd the utilized the OrderSelect() then you could use OpenOrderPrice() - NOT needed in the preceding example. .

  5. #5
    Ah, the reason I queried you will be since when running the EA on a live account it might take the OrderModify using the first OrderOpenPrice(), but not when I used it to specify TP SL.

    I will use your suggestion, thanks!

  6. #6
    Oh.. But can you do this for the OrderSend? If the Ask price changes between the assigning of the double price and the execution of OrderSend, won't it reject the order?

  7. #7
    Ah, wait I see. .

    I must ideally use OrderSelect, obtained it. That's what I will do. . sigh

  8. #8
    Ticket=OrderSend(Symbol(),OP_BUY,Lo ts,askprice,Slippage,0,0,Test EA,16384,0,Green);
    bool xbool = OrderSelect(ticket, SELECT_BY_TICKET);
    OrderModify(ticket,0,OrderOpenPrice()-Point*StopLoss,OrderOpenPrice() Point*TakeP rofit ,0,CLR_NONE);

    Yep, should you apply the OrderSelect() then you can do it as if you intended (without attempting to alter the price of an present order) - You dont need to worry about the price shing. These commands operate in milliseconds. You truly can do quite a bit involving statements without any worries.

  9. #9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.