I am attempting to create a script that downloads a list of stocks from dropbox(I have that part down already) and invests in them if there is available buying power. The list of stocks on dropbox updates every day at 8:30. Everyday at 9:00, I would like the quantconnect script to check to see if we are holding any stocks, if we are, do nothing. If we are not holding any stocks, I want the script to download the data and run my analysis. How should I order this in the code? What parts of the script should go in the Initialize part and what parts should go in the onData part? The parts are: download data, add equities, find momentum, set benchmark, set trailing stop loss, and the checking if the portfolio is invested.