Technical indicator formulas

The maths behind every indicator, on one page. Each row links to a full explainer that defines every variable and walks through the calculation.

Indicator Formulas: This reference lists the mathematical formula for every technical indicator on the site — RSI, MACD, ATR, ADX, Bollinger Bands, moving averages and more — each linking to a full explainer that defines the variables.

IndicatorFormula
Relative Strength IndexRSI = 100 − 100 / (1 + RS), RS = Average Gain / Average Loss
Moving Average Convergence DivergenceMACD = EMA₁₂(close) − EMA₂₆(close); Signal = EMA₉(MACD); Histogram = MACD − Signal
Stochastic Oscillator%K = 100 × (Close − Lowₙ) / (Highₙ − Lowₙ); %D = SMA₃(%K)
Stochastic RSIStochRSI = (RSI − Lowest RSIₙ) / (Highest RSIₙ − Lowest RSIₙ)
Commodity Channel IndexCCI = (TP − SMAₙ(TP)) / (0.015 × Mean Deviation)
Williams %R%R = (Highestₙ − Close) / (Highestₙ − Lowestₙ) × −100
Momentum IndicatorMomentum = Close − Close₍ₙ ago₎
Rate of ChangeROC = (Close − Close₍ₙ ago₎) / Close₍ₙ ago₎ × 100
True Strength IndexTSI = 100 × EMA₁₃(EMA₂₅(ΔC)) / EMA₁₃(EMA₂₅(|ΔC|))
Moving AverageMA = weighted average of the last N closing prices
Simple Moving AverageSMA = (P₁ + P₂ + … + Pₙ) / N
Exponential Moving AverageEMAₜ = α × Priceₜ + (1 − α) × EMAₜ₋₁, α = 2 / (N + 1)
Weighted Moving AverageWMA = (N×Pₜ + (N−1)×Pₜ₋₁ + … + 1×Pₜ₋ₙ₊₁) / (N + (N−1) + … + 1)
Hull Moving AverageHMA = WMA( 2×WMA(N/2) − WMA(N) ), smoothed over √N
Volume Weighted Moving AverageVWMA = Σ(Pᵢ × Vᵢ) / Σ(Vᵢ), over the last N bars
Kaufman Adaptive Moving AverageKAMAₜ = KAMAₜ₋₁ + SC × (Priceₜ − KAMAₜ₋₁); SC = [ER × (fast − slow) + slow]²
SupertrendUpper/Lower Band = (High+Low)/2 ± Multiplier × ATR; Supertrend follows the band in the trend's direction
Ichimoku CloudTenkan=(9-high+9-low)/2; Kijun=(26-high+26-low)/2; SpanA=(Tenkan+Kijun)/2 (fwd 26); SpanB=(52-high+52-low)/2 (fwd 26); Chikou=close (back 26)
Parabolic SARSARₜ₊₁ = SARₜ + AF × (EP − SARₜ)
Average True RangeTR = max(High − Low, |High − prevClose|, |Low − prevClose|); ATR = Wilder-smoothed average of TR over N
Bollinger BandsMiddle = SMA₂₀(close); Upper = Middle + 2σ; Lower = Middle − 2σ
Keltner ChannelMiddle = EMA₂₀(close); Upper = Middle + (2 × ATR); Lower = Middle − (2 × ATR)
Donchian ChannelUpper = Highest High over N; Lower = Lowest Low over N; Middle = (Upper + Lower) / 2
Standard Deviationσ = √( Σ(close − mean)² / N )
Historical VolatilityHV = StdDev(daily log returns) × √(trading days per year)
On-Balance VolumeOBV = Previous OBV + Volume (if Close > Prev Close), − Volume (if Close < Prev Close), + 0 (if unchanged)
Volume ProfileFor each price bucket: Volume(price) = Σ traded volume at that price; POC = price with max Volume; Value Area = smallest price range around POC containing ≈70% of total volume
Volume Weighted Average PriceVWAP = Σ(Typical Price × Volume) / Σ(Volume), where Typical Price = (High + Low + Close) / 3
Money Flow IndexMFI = 100 − 100 / (1 + Money Flow Ratio); Money Flow Ratio = Positive Money Flow / Negative Money Flow
Chaikin Money FlowCMF = Σₙ(Money Flow Volume) / Σₙ(Volume); Money Flow Volume = [((Close − Low) − (High − Close)) / (High − Low)] × Volume
Accumulation/Distribution LineA/D = Previous A/D + Money Flow Volume; Money Flow Volume = [((Close − Low) − (High − Close)) / (High − Low)] × Volume
Ease of MovementEOM = ((High + Low)/2 − (Prior High + Prior Low)/2) / [ Volume / (High − Low) ]; usually smoothed with a 14-period SMA
Average Directional IndexADX = 100 × Wilder-EMA of |(+DI) − (−DI)| / ((+DI) + (−DI))
Directional Movement Index+DI = 100 × Smoothed(+DM) / ATR; −DI = 100 × Smoothed(−DM) / ATR
Aroon IndicatorAroon Up = 100 × (N − periods since highest high) / N; Aroon Down = 100 × (N − periods since lowest low) / N
Vortex IndicatorVI+ = Σ|Highₜ − Lowₜ₋₁| / ΣTR; VI− = Σ|Lowₜ − Highₜ₋₁| / ΣTR
Advance/Decline LineA/D Line = Previous A/D Line + (Advancing stocks − Declining stocks)
McClellan OscillatorMcClellan Oscillator = EMA₁₉(Net Advances) − EMA₃₉(Net Advances)
TRIN (Arms Index)TRIN = (Advancing stocks / Declining stocks) / (Advancing volume / Declining volume)
Awesome OscillatorAO = SMA₅((H+L)/2) − SMA₃₄((H+L)/2)
Accelerator OscillatorAC = AO − SMA₅(AO), where AO = SMA₅((H+L)/2) − SMA₃₄((H+L)/2)
Percentage Price OscillatorPPO = (EMA₁₂ − EMA₂₆) / EMA₂₆ × 100; Signal = EMA₉(PPO); Histogram = PPO − Signal
Detrended Price OscillatorDPO = Price₍(N/2 + 1) bars ago₎ − SMAₙ displaced back by (N/2 + 1) bars
Fisher TransformFisher = 0.5 × ln((1 + X) / (1 − X)), X = normalised median price in [−1, +1]

Every formula links to a full page that defines each variable and shows the calculation step by step. Try them in the calculators.

Frequently asked questions

What is the RSI formula?
RSI = 100 − 100 / (1 + RS), where RS = average gain over N periods ÷ average loss over N periods, with N usually 14. Gains and losses are averaged with Wilder's smoothing.

Last reviewed 8 July 2026. Educational content only — not investment advice.

Educational content only — not investment advice. See our Risk Disclosure and Methodology.