How to backtest multiple stocks in Python as one portfolio
One Python loop backtests ASML, Alphabet, Lumentum and S&P Global as a single portfolio under equal weight, a 200-day trend filter and a momentum rule, checks the adjusted prices against the filings and books the dollar gain of every holding.