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 simple mean-reversion strategy for a stock. The model enters a position when the price reaches either the upper or lower Bollinger Bands for the last X number of days. The model will exit the trade when the stock price crosses the middle Bollinger Band of the same window size.

In iteration Take1, we set up the models using a trend window size for long trades only. The window size varied from 10 to 50 trading days at a 5-day increment.

In iteration Take2, we set up the models using a trend window size for long and short trades. The window size varied from 10 to 50 trading days at a 5-day increment.

In this Take3 iteration, we will experiment with different Bollinger Band factors from 1.0 to 3.0. The models will still use a trend window size for long trades only. The window size varied from 10 to 50 trading days at a 5-day increment.

ANALYSIS: In iteration Take1, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 105.59 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

In iteration Take2, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 70.47 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

In this Take3 iteration, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 143.20 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

CONCLUSION: For the stock of COST during the modeling time frame, the simple long trading strategy with variable Bollinger Band factors 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.

### Like this:

Like Loading...