Delete Order After a Number of Bars have Past.
Results 1 to 4 of 4

Thread: Delete Order After a Number of Bars have Past.

  1. #1
    Can someone please help me with code to delete an open Buy/Sell Stop order that has been opened for a number of bars back.

    Thanks in advance,

  2. #2
    int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();

  3. #3
    @ RR; I appreciate the quick reply. Hopefully I can help you one day soon.
    Quote Originally Posted by ;
    int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();
    Quote Originally Posted by ;
    int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();

  4. #4
    I tried using your code and I think I am doing something wrong because the EA is closing the open trade the next bar open with the following code. Please advise, Inserted Code for(cnt=0;cntlt;total;cnt ) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()lt;=OP_SELLSTOP /check for opened position OrderSymbol()==Symbol()) /check for symbol { if(OrderType()==OP_BUYSTOP) /buystop position is opened { if(TotalOrdersMode(MagicNumber,OP_SELL) lt;= 0) { if(BarCount 5 lt;= Bars) { ticket = OrderDelete(OrderTicket(),Green); } } } else/go to sellstop position { if(TotalOrdersMode(MagicNumber,OP_BUY) lt;= 0) { if(BarCount 5 lt;= Bars) { ticket = OrderDelete(OrderTicket(),Red); } } } } }
    Quote Originally Posted by ;
    int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();
    Quote Originally Posted by ;
    int BarCount; init() /Place an order if(SignalOpen) { OrderSend() BarCount = Bars; } /Delete the order if(BarCount 5 lt;= Bars) OrderDelete();

Similar Threads

  1. Replies: 5
    Last Post: 09:44,
  2. MT4 Object Order
    By milesvorko in forum Cryptocurrencies
    Replies: 5
    Last Post: 23:41,
  3. Smart Order EA werkt niet
    By joanolivas in forum Cryptocurrencies
    Replies: 1
    Last Post: 23:00,
  4. Advanced order EA's
    By franabril6 in forum Cryptocurrencies
    Replies: 1
    Last Post: 13:29,
  5. Pending Order Expiration...
    By trinimol in forum Cryptocurrencies
    Replies: 0
    Last Post: 17:11,

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.