Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Closing a pending stop order when order in other direction is opened

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    15

    Default Closing a pending stop order when order in other direction is opened

    I'm working on an ea that places both a BuyStop and SellStop order. I need a piece of code that will close one of the pending orders if an order in the other direction is filled.

    For example: A BuyStop order is placed 10 pips above current price, and a SellStop order 10 pips below current price. The market goes up and the pending BuyStop order is filled. At that point, I want the SellStop order removed.

    Thanks in advance for the help

  2. #2
    Junior Member
    Join Date
    Oct 2010
    Posts
    17

    Default

    Quote Originally Posted by snkpool View Post
    I'm working on an ea that places both a BuyStop and SellStop order. I need a piece of code that will close one of the pending orders if an order in the other direction is filled.

    For example: A BuyStop order is placed 10 pips above current price, and a SellStop order 10 pips below current price. The market goes up and the pending BuyStop order is filled. At that point, I want the SellStop order removed.

    Thanks in advance for the help
    Hello!
    Just go with for loop through all orders and find out if buy is opened then delete sell pending order (you have to delete and not close pending order) else if sell is opened delete buy pending order.

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    2

    Default anybody can code this strategy as an EA please ?

    Anybody Can Code This Strategy as an EA Please ?

    STRATEGY:

    > EA will open 15 BUY STOP orders & 15 SELL STOP orders. ( number of orders changeable )
    keeping distance 10 Pips from the market price/or given price ( changeable )
    take profit 10 pips & stop loss 15 pips ( changeable) instant.

    Now, if price triggers BUY STOP & hit take profit, as soon as this Order closed

    1> EA will Add a New SELL STOP just above those older Sell Stop orders maintaining the same
    distance 10 pips.

    2> At the same time it will remove a Sell Stop Order from the bottom of those
    older Sell Stops.

    3> EA will add a New BUY STOP order just above those older Buy Stops keeping
    the same distance 10 pips.

    4> As long as market will go to the same direction and hit take profit, EA will
    keep continue the rules. {( all these 4 things must happen in a second ( no delay)}

    > If price triggers SELL STOP first, then opposite rules will be applied ( I hope it's easy for you to understand )

    So, always pending orders distance will be 10 + 10 = 20 pips from the market price

    >>> Now, if price comes back & hit stop loss then EA will add a BUY STOP Just bellow the previous buy stop order
    maintaining the same distance 10 pips.

    >>> And just opposite rules will be applied if price comes back after hitting a Sell Stop & hit stop loss.

    *Number of Pending orders always will be 15 + 15 = 30 (or 29 , coz one will be opened order)

    *please code it for 5 digit mt4
    If I did any mistake (wrong) in description please pardon me and kindly fix it. Hope to get Quick Help.

    Lot Of THANKS in ADVANCE

Similar Threads

  1. Please Change this ea to pending order
    By indra_jangkrik in forum MQL programming
    Replies: 1
    Last Post: 02-13-2015, 14:12
  2. Replies: 0
    Last Post: 10-08-2012, 16:42
  3. PENDING ORDER EA
    By bero in forum Expert advisors backtesting
    Replies: 4
    Last Post: 12-03-2010, 17:23
  4. Pending Order EA
    By arfian in forum Ideas for expert advisors
    Replies: 0
    Last Post: 10-14-2010, 06:59
  5. Delete all pending order
    By fairylord in forum Scripts and other tools
    Replies: 5
    Last Post: 11-01-2009, 23:37

Tags for this Thread

closing, main, pips, profit, sells, stop, strategy, time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •