Cross Over Stock Trading Algorithm

February 17, 2017

Sometimes I wonder if or when I should buy a stock, and I’ll get a stock trading algorithm in my head. Would it beat holding the stock? How risky is it?

One way to access that is testing the algorithm on past market data. Here, I do just that.

Stock Market Analysis

  • Use API to pull stock data
  • Methods to analyze stock data
  • Crossover trading
  • Backtest crossover trading strategy

While this Notebook follows another blog post, I made significant changes to the code and added better visualizations.

Stock Trading Algorithm Testing

  • Test the Crossover trading algorithm on all the stocks in the S&P 500
  • Analyze results

Crossover algorithm often exceeding hold when hold results in loss.

GitHub for this project

Disclaimer: This is in no way financial advice. I am not a financial adviser. This post and code were done as a data analysis exercise only.


Profile picture

Written by  John Tucker

having fun with data