Reputation: 13
I want to develop a strategy where every single trade that I enter will hit either the point of Take Profit or Stop Loss. For example, I have a short entry with the exit settings as below:
strategy.exit("TP/SL", "Short Entry", stop=low + ATR, limit=close - ATR)
but if the next day there's a long entry, it will enter that long position and automatically close my previous short entry, making the exit settings useless. Is there any ways to prevent this? Thanks in advance.
Upvotes: 1
Views: 874
Reputation: 16
After a lot of search finally found it!
Just use strategy.opentrades== 0
when your long or short condition is true:
long = (OSrsi and BullEng) and strategy.opentrades==0
short = (OBrsi and BearEng) and strategy.opentrades==0
Use this condition to enter trades.
Upvotes: 0