In backtesting, by default, the exiting trade is not included in the total number of open trades on its exit bar. For example, I use daily data, on a particular day at open there is 5 open positions of which one is exiting during this day, in the backtest report this day will record 4 open trades. How can I make the exiting trade be counted on the exit bar so that there will be 5 open trades in the above example?
I need this because there is a one day delay for the fund to be available after exiting and other risk management reasons. So I think I will need to use customized backtesting?
Could anyone confirm that there is no easy way to change the internal logic
If you need a one day delay for the cash from a sale to be available for new entries, you can use the SetOption() function with the “SettlementDelay” parameter.
As for “other risk management reasons”, no matter how the number of open trades is calculated you won’t have access to that number unless you write a CBT (Custom BackTest). You would need to be more specific about your goal if you desire a more specific solution.