This is based on moving averages using an evenly weighted portfolio. I tried to make it more of a scaffolding so that other strategies can be interchanged without too much effort. I left all the things not being used commented out. It works better with day to day trading because it's memory hungry as is. It does work with minute trading but needs to be optimized. I've been waiting on the history revisions to be implemented before doing too much.
I feel like I'm on the right track but I also don't have a finance background so please review this, provide feedback, and correct any bogus logic/math.
Also, I would appreciate any resource suggestions to research strategies for weighting portfolio securities.
Update: After looking more at how the live trading works I need to change a lot of things.