This algorithm is roughly based on 2 books: Benjamin Graham's "The Intelligent Investor" and Patrick O'Shaughnessy's "Millenial Money". I am hoping to improve it in the nearest future by telling it to sell only in the case if the Sell - Buy of any given stock is positive, by allocating a different weight to each stock based on the market cap and by hopefully including: some of the more complicated HFT strategies and sentiment analysis.