Algorithmic Trading Model for Moving Average Crossover Momentum Strategy with Volume Indicator Using Python

NOTE: This script is for learning purposes only and does not constitute a recommendation for buying or selling any stock mentioned in this script.

SUMMARY: This project aims to construct and test an algorithmic trading model and document the end-to-end steps using a template.

INTRODUCTION: This algorithmic trading model examines a series of exponential and simple moving average (MA) crossover models via a grid search methodology. The MA models fall under one of two trading approaches: momentum and mean-reversion. This iteration of modeling will focus on applying the models with the momentum approach.

For the momentum approach, when the fast moving-average curve crosses above the slow moving-average curve, the strategy goes long (buys) on the stock. When the opposite occurs, we will exit the position. Furthermore, we will use the trading volumes to confirm the buy and sell signals by comparing them to the 10-day moving average.

ANALYSIS: From this iteration, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 11, 2020. The trading model produced a profit of 96.76 dollars per share. The buy-and-hold approach yielded a gain of 83.71 dollars per share.

CONCLUSION: For the stock of AAPL during the modeling time frame, the trading strategy produced a better return than the buy-and-hold approach. We should consider modeling this stock further by experimenting with more variations of the strategy.

Dataset ML Model: Time series analysis with numerical attributes

Dataset Used: Quandl

The HTML formatted report can be found here on GitHub.