Thank you for your answers.
Ricardo, that's why I get history prices on 300 bars (= 300 days, roughly 10 months). If there is a more convenient way to calculate it, please let me know :)
Max, if I understand well, you advise me to try to change my trading system for a long-term based strategy (monthly) to an intraday strategy ? I will give it a try !
Meanwhile, I improved the algorithm to have several securities at once. I know the algorithm has a survival biais, as I used Amazon, Apple and Microsoft. It was just for the example.