Algorithmic Trading Model for Simple Mean-Reversion Strategy using Python Take 2

SUMMARY: The purpose of this project is to construct and test an algorithmic trading model and document the end-to-end steps using a template.

Additional Notes: This is an adaptation of the momentum trading strategy from Chapter 2 of Learn Algorithmic Trading by Sebastien Donadio and Sourav Ghosh with Packt Publishing (https://www.packtpub.com/data/learn-algorithmic-trading-fundamentals-of-algorithmic-trading).

INTRODUCTION: This algorithmic trading model uses the support and resistance levels to generate trading signals for a mean-reversion trading strategy. The strategy is to create a buy order when the stock price stays in the support tolerance margin after a waiting period of two days. Conversely, the model generates a signal for a sell order when the stock price remains in the resistance tolerance margin after the same waiting period.

We apply the analysis on a stock for a fixed period and compare its return/loss to a simple long-only model. The long-only model will purchase the stock at the opening of day one and hold the stock through the entire time.

In iteration Take1, we constructed and tested a mean-reversion trading model for the stock “GOOG” during the three years between 2017 and 2019 with an investment pool of 1,500 USD.

In this Take2 iteration, we will construct and test a mean-reversion trading model for the stock “GOOG” during the three years between 2017 and 2019 with an investment pool of 1,500 USD. Instead, we will change the waiting period from two days to one day, three days, four days, and five days.

ANALYSIS: In iteration Take1, the mean-reversion trading strategy with a waiting period of two days returned 3.65%.

In this Take2 iteration, the mean-reversion trading strategy with a waiting period of one day returned 19.40%.

The mean-reversion trading strategy with a waiting period of three days returned 12.03%.

The mean-reversion trading strategy with a waiting period of four days returned 6.73%.

The mean-reversion trading strategy with a waiting period of five days returned 6.49%.

CONCLUSION: For this period, the mean-reversion trading strategy did not outperform the more straightforward long-only approach, so we should consider modeling more and different methods for this stock.

Dataset ML Model: Time series analysis with numerical attributes

Dataset Used: Various sources as illustrated below.

Dataset Reference: Various sources as documented below.

The HTML formatted report can be found here on GitHub.