Skip to main content
Asked a question 2 years ago

How can I automate a strategy that has both a defined exit as well as a stop-loss? For example, I have a ADX/DMI strategy in which I go long if ADX>25 and DI+ > DI-, I put a stop loss of 2.5% but I also have a defined exit: DI+ < DI-. If I only use stop loss, I can use CO, but modifying/cancelling CO through API Bridge is hard. I cannot use BO as I don't know when DI+ will cross below DI-. Not using CO will send at minimum three orders per trade, which I want to avoid. Any suggestions? (I use API Bridge with AmiBroker)

Join FYERS Community to pick others' brains on Trading/Investing

Hi Rakesh,

Yes, Using CO makes this a bit difficult as an exit order is sent along with the entry order in case of CO as explained on the below link:

Exiting Bracket Order and Cover Order - MyCoder33
Not using CO would be a better option here. When the DI+ crosses below DI-, the exit order that gets generated would cancel the pending SL order by using the below Signal Rule in API Bridge. 

We are already sending 2 orders (entry and SL) so, adding an exit based on defined formula adds one more order which should not be an issue.

How can I automate a strategy that has both a defined exit as well as a stop-loss? For example, I have a ADX/DMI strategy in which I go long if ADX>25 and DI+ > DI-, I put a stop loss of 2.5% but I also have a defined exit: DI+ < DI-. If I only use stop loss, I can use CO, but modifying/cancelling CO through API Bridge is hard. I cannot use BO as I don't know when DI+ will cross below DI-. Not using CO will send at minimum three orders per trade, which I want to avoid. Any suggestions? (I use API Bridge with AmiBroker)