We collect cookies to improve your browsing experience. By using our site, you agree to ourPrivacy Policy andTerms of Service.

A Super Effective Momentum Trading Strategy
Bubble Analytics Research21-Jun-2026

A Super Effective Momentum Trading Strategy

Summary:

Ticker:QQQ
Timeframe:Daily
Backtest Window:10yrs
Time Invested:51.91%
# Trades:169
Win Rate:63.91%
Total Return:398.65%
Max Drawdown:-23.93%
Sharpe Ratio:0.91
Profit Factor:2.41

Hello coders. On the IDE this week is a simple but highly effective strategy that creates a momentum based indicator, that tracks how far price has moved over a set period of time. We are focusing on a short timeframe of 5 days and looking for extreme negative readings to buy lows, and negative to positive turns that indicate favourable outcomes ahead.

As usual we have settled on the Nasdaq 100 index (QQQ) for our backtest, with 10 years worth of daily OHLC bars downloaded from Yahoo Finance into a dataframe named df, and the backtest itself is run using the backtesting.py library. We will show you how to calculate the indicator, apply it to price, generate trading signals, then run a full backtest and output the results.

The completed codebook along with our backtesting template can be downloaded via our GitHub profile, but for more detailed coding instruction you can refer to the video on our YouTube channel which shows you how to construct it from start to finish. Please note that the article strategy is for infotainment purposes only and should not be construed as financial advice.

Calculating Momentum

More formally called rate of change (ROC), watching momentum values change is a simple yet powerful way to track relative extremes in price movement. It is calculated as the percentage difference between today’s closing price and the closing price n periods ago. Traders often use ROC to identify the strength and direction of trends, look for reversals, or confirm breakouts. During strong uptrends, ROC typically remains above zero, while sustained readings below zero indicate persistent downward momentum.

The code is as follows:

df['Momentum'] = (df['Close'] / df['Close'].shift(5) - 1) * 100

Rather than combine it with another indicator, we are going to create a strategy that uses momentum values only. To pick out lows we look for readings below -5 over our 5 period lookback window i.e. times when price dropped 5% or more over 5 days. However, as drops of that magnitude and speed are fairly rare, we will also look for periods where momentum turned positive and use those to trigger long trades also.

The signal function loops through our dataset one row at a time, using the .iloc method to access values by their integer position rather than by date or index label. Starting from the third row (i = 2), it checks the current and previous Momentum values to generate trading signals. If the current Momentum value (data['Momentum'].iloc[i]) is less than -5, a buy signal (1) is generated. If the previous Momentum value (data['Momentum'].iloc[i-1]) was below zero but the current value has crossed back above, a second buy signal (2) is generated. If neither condition is met, no signal (0) is produced. Code as follows:

def signal(data):
signal = [0] * len(data)
for i in range(2,len(data)):
if (data['Momentum'].iloc[i] < -5):
signal[i] = 1
elif (data['Momentum'].iloc[i-1] < 0) and (data['Momentum'].iloc[i] > 0):
signal[i] = 2
else:
signal[i] = 0
data["signal"] = signal
signal(df)

With our buy and sell signals now contained within our dataset, we generated a price chart for QQQ with the momentum indicator below, and primary buy signals rendered as white dots, with secondary buy signals marked by yellow dots. Chart as follows:

Section 14

We then ran a backtest on QQQ (daily timeframe) over 10 years, utilising a 2% profit target on primary (white) buy signals, and a 3.5% profit target on secondary (gold) long trades with a 2% stop loss. The results were respectable, generating a 398% overall return, with a low maximum drawdown figure. Full strategy stats are as follows:

Stats 16

A profit and loss graph is included below showing that it performed extremely well over the 2021-2022 bear market period. There are very little in realised drawdowns for the full 10 year backtest period, and it seems to work well in all market regimes.

Section 18

The MonteCarlo simulation creates a cumulative return based on percent gain or loss per trade, and randomises the trade order 100 times before displaying each equity curve on the chart. This one shows a strong bottom left to top right profile, with very little variance in the lines, suggesting relative safety in the strategy:

Section 20

As always, further parameter optimisation, regime filtering, or volatility targeting may improve performance. This article strategy is presented for educational purposes only and should not be considered financial advice. For a detailed run through of the codebook, please watch the video below.

Looking for algorithmic trading signals? Bubble Analytics provides real-time trade notifications generated by systematically tested strategies, complete with detailed performance statistics, trade histories and risk metrics. Explore our live trading signals and start your free 30-day trial today. ->

Share this article:

Explore our services

Recent Articles

Browse all articles