Description
I am new to backtesting framework and recently learned python so need some help to implement a strategy, I want to implement a strategy which opens long or short trades without any stop loss and take profit level. I get that I can do that using self.buy() and self.sell() methods of strategy class as in examples but I am not sure how I close a trade as there's no self.close(). My strategy may have multiple long and short trades open at same time and each trade needs to be explicitly closed by strategy based on certain criteria (not by stop loss or take profit). I get that I need to have exclusive_orders=False. Do I need to loop through all open positions or trades and then call close on Position or Trade, if so how do I uniquely identify a Position or Trade? would be helpful if you can point me to or provide a related example snippet.
Thanks