Close pending order on profit taken by magic number
1 2

thread: Close pending order on profit taken by magic number

  1. #1

    Close pending order on profit taken by magic number

    -

  2. #2
    Quick bump, still searching for one to achieve this. I discovered a bit of the needed code on some other forum I think but I do not have any idea how to achieve this.
    Right now it closes pending orders on ALL pairs too. Therefore I am also searching for a an implementation of the final of pending orders on a single pair only. . The code below does so but I cannot figure out how to implement this in the already existing code.

    for(int inProfit = OrdersTotal()-1; pos gt;= 0; pos--) if ( OrderSelect(inProfit, SELECT_BY_POS) // Only my orders w/ OrderMagicNumber() == magic.number // my magic number OrderSymbol() == Symbol() // and emblem OrderProfit() gt; 0 ) CloseAll(); split; ...

    void CloseAll() for(int pos = OrdersTotal()-1; pos gt;= 0; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ OrderMagicNumber() == magic.number // my magic number OrderSymbol() == Symbol() ) // and symbol if (OrderType()lt; OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClose(), Slippage.Pips*pips2points, Aqua ); otherwise OrderDelete(OrderTicket());

  3. #3
    Attachment from above also does not appear to properly close pending orders when a predetermined number of pips has been struck...

  4. #4
    Strange matter is that the EA from original place does function properly once it triggers positions and when the user then restarts MT4. It is going to then shut all pending orders.

  5. #5
    So why does the indior from article #1 NOT near pending orders as intended when a take profit is struck out of a different current busy market order?
    Can it be something with the code or is it a flaw on new MT4 updates?

    Past 6 hours have been already invested in order to figure it out but with little to no succes. So action in here. No mq4 coders whatsoever?

  6. #6
    Request is not needed anymore. Thank you for your time

  7. #7
    Ask is not required anymore. Thanks for your time
    Why do you thank us, since nobody of us helped you?

  8. #8
    quote why is it that you thank ussince no one of us helped you?
    There's always a possibility of someone having read / even started to code. To those worried I thank them.What a strange question from how...

  9. #9

  10. #10
    I found an Option but if it somehow shows flaws again I'll be sure to Check to this one, thanks

  •