TradingView indicators

Constance Brown Composite Index: formula and divergence rules

The Composite Index adds RSI momentum to a smoothed short RSI, then plots averages of the result. Use it beside RSI to compare momentum swings. Its level is not a probability, and a divergence does not establish that price will reverse.

CI = RSI(14) − RSI(14)[9] + SMA(RSI(3), 3)

Public difference-based form. Fast line: SMA(CI, 13). Slow line: SMA(CI, 33). All periods count chart bars.

Separate the method from a particular script

Brown's 2023 CMT presentation develops momentum on RSI and describes the Composite Index as a hybrid oscillator. The original task is to examine disagreements between RSI and Composite Index, including situations where RSI does not show a useful divergence. A price-versus-CI pivot scan is a separate mechanical rule, not a complete reproduction of Brown's analysis.

The code below implements the public arithmetic documented by TraderGB and used in Pineify's indicator calculation. LazyBear's 2014 TradingView publication is an open-source Pine reference. Optuma describes its Brown study as proprietary. We do not claim author endorsement, a license to proprietary code, or exact parity with every platform.

Version details matter: percentage ROC is different from an RSI point difference; subtracting 50 changes the center; EMA and SMA give different lines. StockCharts labels its change term ROC, so compare actual closed-bar values before treating two implementations as identical. Consult the source publications and access terms before adapting their code.

Calculate the components before reading the line

This hypothetical calculation begins with already-computed RSI values. It demonstrates the arithmetic, not a historical trade or a claimed performance result.

Composite Index component calculation in RSI points
ComponentInputsResult
9-bar RSI momentumRSI(14) now 62; nine bars ago 5562 − 55 = 7
Smoothed short RSILast three RSI(3) values: 72, 66, 60(72 + 66 + 60) / 3 = 66
Composite IndexMomentum + smoothed short RSI7 + 66 = 73
13-bar fast averagePrevious 12 CI values sum to 780(780 + 73) / 13 = 65.6154
33-bar slow averagePrevious 32 CI values sum to 2,048(2,048 + 73) / 33 = 64.2727

The two averages smooth CI after the addition. They do not feed back into the composite calculation. Replacing the point difference with percentage ROC would change the first result from 7 to about 12.73, and CI from 73 to about 78.73.

Why zero and 70/30 do not transfer from other oscillators

CI can exceed RSI's 0-to-100 range. For this exact formula, each valid RSI lies within 0 to 100, its difference lies within -100 to 100, and the short RSI average lies within 0 to 100. Their sum therefore stays within an algebraic envelope of -100 to 200. The endpoints are not promised attainable extremes or useful entry levels.

A positive CI does not imply positive RSI momentum: −15 + 60 = 45. The added RSI term shifts the level. Likewise, CI = 73 does not inherit RSI's conventional overbought interpretation. Compare swings and components instead of importing RSI thresholds.

Fix the pivot rule and its confirmation delay

The example script uses price pivots with three left bars and three right bars. It samples CI on those same price-pivot bars. A lower CI sample need not be a local CI peak, which makes this different from matching independently detected oscillator pivots.

Explicit divergence detection and timing rules
RuleRequired observationAvailability
Bearish warningHigher price pivot high; lower CI at that pivotSecond pivot confirmation close
Bullish warningLower price pivot low; higher CI at that pivotSecond pivot confirmation close
EqualityEqual price or CI sampleNo warning under these strict comparisons
Warm-upTwo valid pivots of the same kind and CI historyWait while needed values are unavailable

A pivot at bar 100 becomes known at the close of bar 103 with rightBars = 3. On a 1-hour chart that means three subsequent chart bars, which may span a session gap. The marker belongs on bar 103. Drawing it back at bar 100 can make a historical chart look earlier than the actionable information.

A confirmed divergence can still fail

Suppose confirmed highs at bars 80 and 100 have price values 100 and 104, while CI at those bars falls from 88 to 73. The bearish warning is available on bar 103. If price then reaches 108 at bar 110, the warning did not stop the uptrend. This hypothetical path shows the distinction between a correctly detected disagreement and a successful reversal trade.

A later close below an intervening swing low can be a separate price-confirmation rule. It adds delay and can also fail. Define the entry, invalidation, exit, costs, and evaluation window before testing; the indicator below places no orders and makes no profitability claim.

Pine Script v6: formula and confirmed warnings

Paste this indicator into TradingView's Pine Editor, save it, and add it to a standard candlestick chart. The blue CI line and its 13/33 averages remain in their original scale. Component values are available in the Data Window. Select a divergence condition in TradingView's alert dialog and use Once Per Bar Close.

Pine Script v6
//@version=6
// Educational implementation of the public RSI-difference formula.
// Method attribution: Constance Brown. Not an official licensed edition.
indicator("Composite Index: confirmed price-pivot divergence", overlay = false)

source = input.source(close, "RSI source")
rsiLength = input.int(14, "RSI length", minval = 2)
momentumLength = input.int(9, "RSI momentum lookback", minval = 1)
shortRsiLength = input.int(3, "Short RSI length", minval = 2)
smoothingLength = input.int(3, "Short RSI SMA length", minval = 1)
fastLength = input.int(13, "Composite fast SMA", minval = 1)
slowLength = input.int(33, "Composite slow SMA", minval = 1)
leftBars = input.int(3, "Price pivot left bars", minval = 1)
rightBars = input.int(3, "Price pivot right bars", minval = 1)

rsiValue = ta.rsi(source, rsiLength)
rsiMomentum = rsiValue - rsiValue[momentumLength]
smoothedRsi = ta.sma(ta.rsi(source, shortRsiLength), smoothingLength)
composite = rsiMomentum + smoothedRsi
fastAverage = ta.sma(composite, fastLength)
slowAverage = ta.sma(composite, slowLength)
plot(composite, "Composite Index", color = color.blue, linewidth = 2)
plot(fastAverage, "Fast SMA", color = color.orange)
plot(slowAverage, "Slow SMA", color = color.gray)
plot(rsiMomentum, "RSI momentum", display = display.data_window)
plot(smoothedRsi, "Smoothed short RSI", display = display.data_window)

// Sample CI at consecutive confirmed PRICE pivots, not separate CI pivots.
priceHigh = ta.pivothigh(high, leftBars, rightBars)
priceLow = ta.pivotlow(low, leftBars, rightBars)
ciAtPivot = composite[rightBars]
var float previousHigh = na
var float previousHighCi = na
var float previousLow = na
var float previousLowCi = na
bool bearish = false
bool bullish = false
if barstate.isconfirmed and not na(ciAtPivot)
    if not na(priceHigh)
        bearish := not na(previousHigh) and priceHigh > previousHigh and ciAtPivot < previousHighCi
        previousHigh := priceHigh
        previousHighCi := ciAtPivot
    if not na(priceLow)
        bullish := not na(previousLow) and priceLow < previousLow and ciAtPivot > previousLowCi
        previousLow := priceLow
        previousLowCi := ciAtPivot

// Mark the confirmation bar. No negative offset or backdated signal.
plotshape(bearish, "Bearish divergence confirmed", shape.triangledown, location.top, color.red, size = size.tiny)
plotshape(bullish, "Bullish divergence confirmed", shape.triangleup, location.bottom, color.green, size = size.tiny)
alertcondition(bearish, "Bearish CI divergence", "Higher price high and lower CI at confirmed price pivots.")
alertcondition(bullish, "Bullish CI divergence", "Lower price low and higher CI at confirmed price pivots.")

The lines update during an open bar. Warnings wait for bar close and the right-hand pivot window; they use no negative plot offset and no higher-timeframe request. They compare consecutive eligible price pivots, without a maximum spacing filter. Inspect widely separated pivots before treating the warning as one coherent setup.

Keep the source, RSI periods, smoothing type, chart session, and loaded history identical when checking another implementation. The slow average needs additional valid CI history. A syntax check does not prove numerical parity, alert delivery, or trading performance.

Adapt a specified version with Pineify

Pineify's Pine Script AI Coding Agent can help create or modify code from an explicit formula. Supply the version and source you are authorized to use, then ask for the confirmation rule you want. Review the generated script and explicitly request a syntax check before comparing chart values.

Use the difference-based Composite Index with RSI 14, momentum 9, short RSI 3, SMA 3, and CI averages 13/33. Keep the source attribution. Sample CI at confirmed price pivots with left/right 3/3. Put warnings on the confirmation bar and explain any changes to this formula.

The agent does not supply access to protected scripts or establish an author's permission. This is an educational indicator workflow, not investment advice or a guarantee of returns.

Open Pine Script AI Coding Agent

Composite Index questions

Sources and implementation scope

Sources checked October 17, 2026. Formula arithmetic and hypothetical cases on this page are explicit deductions, not reported trading results.

Continue with the RSI reference or browse TradingView indicator guides.