I am going to create a backtesting/trading system. One of my exit conditions is: If a stock is bought after 20 days, it will exit. How is the code for that?
Besides, I don’t want to set the fix number of the stock. I want to use 5% for example of the capital. How to do that?