Setting holding period
Hi, I'm new to backtrader and have been looking for solutions on preset holding period while backtesting.
Here is what I'm looking to achieve:
Suppose I have a strategy that says, go long a stock if condition A happens and go short a stock if condition B happens. For each position, the holding period of the trade is 1 month.
Is there an easy way to do that?
The logic in the strategy has to remember when a position was entered, probably in
notify_orderby checking the date from the notified order
order.executed.dtwhich can be translated to a
datetimeinstance like this for example: order.data.num2date(order.executed.dt)`
And then checking when the data hits a month later
self.data.datetime, where you can get instances with