I have in mind a strategy to backtest. Buy is at the start of day, sell is during the day or at last at the end of day. I'd like to buy 10 shares of all which have the most percentage gain from previous day close. Sell is based on stop-loss 5%. So the script will not know what shares to analyze as it changes for every day.