In this post we will look at the momentum strategy from Andreas F. Clenow’s book Stocks on the Move: Beating the Market with Hedge Fund Momentum Strategy and backtest its performance using the survivorship bias-free dataset we created in my last post with Backtrader. Momentum strategies are almost the opposite of mean-reversion strategies. A typical momentum strategy will buy stocks that have been showing an upward trend in hopes that the trend will continue.

Continue reading

When developing a stock trading strategy, it is important that the backtest be as accurate as possible. In some of my previous strategies, I have noted that the backtest did not account for survivorship bias. Survivorship bias is a form of selection bias caused by only focusing on assets that have already passed some sort of selection process. A simple example would be a strategy that simply buys and holds an equal allocation of the current S&P 500 constituents.

Continue reading

In my last post we implemented a cross-sectional mean reversion strategy from Ernest Chan’s Algorithmic Trading: Winning Strategies and Their Rationale. In this post we will look at a few improvements we can make to the strategy so we can start live trading! Setup We will be using the same S&P 500 dataset we created in the last post. Let’s load it in. from datetime import datetime import pandas as pd import backtrader as bt import numpy as np import matplotlib.

Continue reading

In this post we will look at a cross-sectional mean reversion strategy from Ernest Chan’s book Algorithmic Trading: Winning Strategies and Their Rationale and backtest its performance using Backtrader. Typically, a cross-sectional mean reversion strategy is fed a universe of stocks, where each stock has its own relative returns compared to the mean returns of the universe. A stock with a positive relative return is shorted while a stock with a negative relative return is bought, in hopes that a stock that under or outperformed the universe will soon revert to the mean of the universe.

Continue reading

In my last post we discussed simulation of the 3x leveraged S&P 500 ETF, UPRO, and demonstrated why a 100% long UPRO portfolio may not be the best idea. In this post we will analyze the simulated historical performance of another 3x leveraged ETF, TMF, and explore a leveraged variation of Jack Bogle’s 60 / 40 equity/bond allocation. First lets import the libraries we need. import pandas as pd import pandas_datareader.

Continue reading

In this post we will look at the long term performance of leveraged ETFs, as well as simulate how they may have performed in time periods before their inception. Many people would recommend against holding a position in a leveraged ETF because of beta slippage. Lets take a look at the performance of SPY, an S&P 500 ETF, versus UPRO, a 3x leveraged S&P 500 ETF. First lets import a few libraries.

Continue reading

Teddy Koker

Student, Software Engineer.

Software Engineer

Boston, MA