Question on OrderModify and OrderClose
Results 1 to 3 of 33

Thread: Question on OrderModify and OrderClose

  1. #1
    Hello
    I am at the task of automatize some trades but what I've got interfere with manual opened tradesI hope someone can point what is missing
    my own OrderModify:
    RefreshRates();
    // Calculate Trailing Stop.
    If ( Ask lt;= OrderOpenPrice() - TrailingStart * Point OrderStopLoss() gt; Ask ( TrailingStop * Stage ) )
    Ticket = OrderModify ( OrderTicket(), OrderOpenPrice(), Ask ( TrailingStop * Stage ), OrderTakeProfit(), 0 );

    ---------------
    My CloseOrder:
    Ticket = OrderClose ( Ticket, OrderLots(), OrderClosePrice(), Slippage, Red );
    ----------------
    I think it's related to magic amount, this can be my OrderSend:

    Ticket = OrderSend ( Symbol(), OP_SELL, Lots, Bid, Slippage, Bid ( StopLoss * Stage ), Bid - ( TakeProfit * Point ), NULL, mymagic, 0, Red);
    LastOrder = 0;

    How do I avoid the bot to jump on previous opened trades?
    Thank you for any help

  2. #2

  3. #3
    Quote Originally Posted by ;
    Hello I'm at the task of automatize some trades but what I've got interfere with manual opened trades, I hope someone can point what's missing my OrderModify: RefreshRates(); // Calculate Trailing Stop. If ( Ask lt;= OrderOpenPrice() - TrailingStart * Stage OrderStopLoss() gt; Ask ( TrailingStop * Stage ) ) Ticket = OrderModify ( OrderTicket(), OrderOpenPrice(), Ask ( TrailingStop * Stage ), OrderTakeProfit(), 0 ); --------------- My CloseOrder: Ticket = OrderClose ( Ticket, OrderLots(), OrderClosePrice(), Slippage, Red ); ----------------...
    FxCba
    Somewhere you ought to be trapping for your MagicNumber and OrderSymbol()
    manually put orders do not possess a MagicNumber. That should fix that issue.
    Inserted Code for(cnt=0;cntlt;total;cnt ){ if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)==TRUE){ if(OrderMagicNumber() == MagicNumber OrderSymbol()==Symbol()){

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.