Limit backtest trades in a 2 year period

Hi All

Is there a way to limit the number of trades (20) in a portfolio backtest over a period of 2 years?



I feel there is too little information to respond properly
Can you provide more details or clarify your request:
For example, do you really mean want to limit the number of simultaneous positions (e.g. stocks) to 20?

Maybe you could provide a descriptive example of what you want to accomplish.

Also, please be careful about opening new topics that may actually be a continuation of another. This request seems to be continuing the discussion from Limit number of new positions for a single day:

If you want to limit the total number of entries in a rolling 2-year period to 20, then I think you’ll need to use the CBT.

Thanks guys.

I wanted my backtest to enter into 20 trades total in two years so after each of the 20 trades have closed no more trades will be opened.

This is because after these 20 trades I will re optimise my parameters and do a new 20 trades.