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

The CMB Composite Index Strategy
Bubble Analytics Research24-May-2026

The CMB Composite Index Strategy

Summary:

Ticker:QQQ
Timeframe:Daily
Backtest Window:10yrs
Time Invested:56.6%
# Trades:172
Win Rate:67.44%
Total Return:602.02%
Max Drawdown:-19.04%
Sharpe Ratio:1.28
Profit Factor:2.59

This week we are taking a look at the CMB Composite Index, which was first introduced by Constance Brown in her book Technical Analysis for the Trading Professional in March 1999. The CMB attempts to improve upon Welles Wilder’s RSI indicator, making it unbound so that values can move outside of the RSI 0-100 limits, and using rate of change plus a simple moving average to add a momentum component that better captures reversal signals.

Constance Brown recommended looking for divergences between the CMB and RSI indicators, but that wouldn’t fit with our goal today which is to create a strategy around the CMB Composite Index on a stand-alone basis. The strategy has been constructed on the Nasdaq 100 index (QQQ), 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.

As usual, we will be showing you how to create the indicator, display it on a price chart, then create and backtest an example strategy. The completed codebook along with our backtesting template can be downloaded for free via our GitHub profile, and for in depth coding instruction you can watch our YouTube video. Please note that the article strategy is for infotainment purposes only, and should not be construed as financial advice.

Calculating the CMB Indicator

To create CMB we first calculate RSI, starting by taking the bar-to-bar difference in Close prices (pc). Using Pandas’ clip function, positive changes are stored in ‘up’ and absolute negative changes in ‘dn’, which are then smoothed with an exponential moving average (avg_up and avg_dn) over a chosen lookback period (n). Relative strength (RS) is computed as avg_up / avg_dn and transformed into a bounded oscillator using the formula RSI = 100 − (100 / (1 + RS)).

def RSI(data, n):
pc = data['Close'].diff()
up = pc.clip(lower=0)
dn = pc.clip(upper=0).abs()
avg_up = up.ewm(alpha=1/n, adjust=False).mean()
avg_dn = dn.ewm(alpha=1/n, adjust=False).mean()
RS = avg_up / avg_dn
RSI = 100 - (100 / (1 + RS))
return RSI

By calling our new RSI function above and specifying data and lookback period, we create two new columns in our dataframe (df) with values for RSI(14) and RSI(03), which will then be used in the construction of our CMB Composite Index indicator.

df["RSI14"] = RSI(df, 14)
df["RSI03"] = RSI(df, 3)

To calculate CMB, we first take the 9-period rate of change of RSI(14) values (RSI_Chg), then take a 3-period simple moving average of RSI(03) values (RSI_Mom), and define our composite index line (CIL) as RSI_Chg + RSI_Mom. From our composite index line we create two further moving averages, the 13-period average of CIL (Fast), and the 33-period average of CIL (Slow). The function returns CIL, Fast and Slow which we again store as values in our dataframe (df).

def CMB(data):
RSI_Chg = ((data.RSI14 - data.RSI14.shift(9)) / data.RSI14.shift(9)) * 100
RSI_Mom = data.RSI03.rolling(3).mean()
CIL = RSI_Chg + RSI_Mom
Fast = CIL.rolling(13).mean()
Slow = CIL.rolling(33).mean()
return CIL, Fast, Slow
df["CIL"], df["Fast"], df["Slow"] = CMB(df)

When viewed on a chart the indicator is comprised of 3 lines that can move above 100 and below zero. As the white line (CIL) moves higher it means upward momentum is accelerating i.e. rate of change for RSI over our 9 day lookback period is increasing, and short-term RSI momentum is strengthening. In price terms, especially on longer timeframes, this reflects good buying pressure and suggests we are entering or continuing a bullish phase rather than a price correction.

Section 14

The Strategy

For our trading strategy we will be amending the lookback periods for RSI14 and RSI3 to 28 and 6 respectively (just the lookback periods rather than the column names so the code can stay the same), and the goal is to use all 3 indicator lines. We buy when the Composite Index Line (CIL) crosses above the Fast line; and sell when Fast crosses from above to below Slow.

For backtesting purposes we need to create a signal column within our dataframe (df) to tell backtesting.py when to buy (1), when to sell (2), and when to do nothing (0). The code below creates a signal column matching the length of our dataframe and loops over the values in each row, changing the signal value to a 1 where our buy conditions are met, changing to a 2 where sell conditions are met, or 0 where no condition was met.

def signal(data):
signal = [0] * len(df)
for i in range(0,len(df)):
if (data.CIL.iloc[i-1] < data.Fast.iloc[i-1]) &\
(data.CIL.iloc[i] > data.Fast.iloc[i]):
signal[i] = 1
elif (data.Fast.iloc[i-1] > data.Slow.iloc[i-1]) &\
(data.Fast.iloc[i] < data.Slow.iloc[i]):
signal[i] = 2
else:
signal[i] = 0
df["signal"] = signal
signal(df)

Running the Backtest

Once our signal column values are populated, we can then run the backtest. We define a SIGNAL function to take in the values of our signal column, then create a strategy class called MyStrat. Within MyStrat we initialise the SIGNAL function, create a price reference point we can key off to set stop losses and profit targets, then use if statements to tell the backtesting program what action to take when a buy or sell signal is found.

In this case, if the signal equals 1 we close any open short positions and buy shares in QQQ with the amount set to 99% of our available balance (size=0.99), and set a profit target of 3% with a stop loss of 10%. If the signal equals 2 we check for an open long position and close it, then short the market with the amount again set to 99% of our available balance, with a stop set at 3% and a profit target of 5%.

When we come to run the backtest, we tell it where to find our signal column values (df), which strategy class we want to run (MyStrat), define the starting capital allocation (cash=100_000), set it to use no leverage (margin=1), set a rule whereby we can only have one open position at a time (exclusive_orders=True), and tell it to factor in a 0.05% commission fee when the trade is opened and when closed out (commission=0.0005) for a total fee of 0.1%.

def SIGNAL():
return df.signal
class MyStrat(Strategy):
def init(self):
super().init()
self.signal = self.I(SIGNAL)
def next(self):
super().next()
price = self.data.Close[-1]
if self.signal==1:
if self.position.is_short or not self.position:
self.position.close()
self.buy(size=0.99, tp=1.03*price, sl=0.9*price)
elif self.signal==2:
if self.position.is_long or not self.position:
self.position.close()
self.sell(size=0.99, tp=0.95*price, sl=1.03*price)
bt = Backtest(df, MyStrat, cash=100_000, margin=1, exclusive_orders=True, commission=0.0005)
stats = bt.run()
stats

Strategy Results

The strategy reduced our market exposure time down to 56% while returning only marginally less than buy and hold over the same period. In total 172 trades were placed, with a win rate of 67.44% and the average trade made 1.15% suggesting promise in the strategy.

Stats 26

The max drawdown was 19% which is much less than a passive strategy which experienced a 40%+ drawdown in the bear market of 2021-2022. The profit and loss chart emphasises the strategy’s steady performance, with a good looking bottom left to top right profile, and only relatively brief pauses in upward trajectory.

Section 28

Since we have more than enough trades, we have modelled risk via a Montecarlo simulation which is good looking and again emphasises validity in the strategy.

Section 30

Overall the strategy appears to be effective at getting you long during strong bullish momentum phases, and makes the most of short term weakness. Market exposure is two thirds of buy and hold with only a marginal reduction in the return and reduced drawdowns. We think this strategy has promise and merits further optimisation testing.

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.

Share this article:

Explore our services

Recent Articles

Browse all articles