Algorithmic Trading Model for Mean-Reversion vs. Trend-Following Strategy for an Individual Stock 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 compares a simple mean-reversion strategy with a trend-following for a single stock. The model will use a trend window size of ten days for long trades only.

ANALYSIS: In this modeling iteration, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and July 9, 2021. The mean-reversion model produced a profit of 101.20 dollars per share, while the trend-following model returned a profit of 154.21. The buy-and-hold approach yielded a gain of 248.74 dollars per share.

CONCLUSION: For the COST stock during the modeling time frame, the long-only trading strategy with either mean-reversion or trend-following approach did not produce 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.