I study technical indicators daily to improve my trading edge, and understanding how indicators are constructed helped me separate useful signals from noise. In this article I explain the mechanics behind three widely used oscillators—RSI, MACD, and the Momentum indicator—so you can compute them, interpret them, and troubleshoot common issues.
I write from hands-on experience with charting platforms and spreadsheet calculations, and I focus on the math and practical settings that matter most when you build or backtest strategies.
Quick summary

- RSI measures average gains versus average losses over a lookback period and maps the result to a 0–100 scale to indicate overbought/oversold conditions.
- MACD is a difference between two exponential moving averages (fast minus slow) plus a smoothed signal line; its histogram shows momentum changes and crossovers.
- The Momentum indicator is a rate-of-change style oscillator that compares current price to a price N periods ago; it is simple and sensitive to recent moves.
- All three rely on smoothing and lookback choices that change responsiveness and false-signal rates—shorter periods = more signals, longer periods = fewer but smoother signals.
- Common troubleshooting steps include checking smoothing methods, ensuring consistent price inputs (close vs. typical price), and confirming alignment of indicator periods with your timeframe.
How the Relative Strength Index (RSI) is constructed
Formula and step-by-step calculation
The classic RSI uses a lookback period (commonly 14). Calculation steps:

- Calculate the change (delta) from one close to the next for each period in the window.
- Separate gains (positive deltas) and losses (absolute value of negative deltas).
- Compute the average gain and average loss—Wilder’s original method uses smoothed averages (an exponential-style smoothing): initial averages are simple means for the first window, then subsequent averages are: avgGain = ((prevAvgGain * (n-1)) + currentGain) / n.
- Calculate Relative Strength (RS) = avgGain / avgLoss.
- Convert to RSI = 100 − (100 / (1 + RS)).
Interpretation and common settings
RSI values above 70 are commonly considered overbought; below 30 are oversold. Many traders adjust thresholds (e.g., 80/20) for trending markets. Shorter lookbacks (like 7) make RSI more sensitive; longer (21+) smooth it.
Important nuance: the smoothing method affects momentum persistence. Wilder’s smoothing produces a slower decay than a simple moving average of gains and losses.
How the Moving Average Convergence Divergence (MACD) is constructed
Formula and step-by-step calculation
MACD is built from exponential moving averages (EMAs). Standard parameters are 12 (fast), 26 (slow) and 9 (signal). Steps:
- Compute EMA_fast (e.g., 12-period EMA) and EMA_slow (e.g., 26-period EMA) on the chosen price (usually close).
- MACD line = EMA_fast − EMA_slow.
- Signal line = EMA of the MACD line over the signal period (e.g., 9-period EMA of MACD).
- Histogram = MACD line − Signal line (visualizes convergence/divergence).
Interpretation and common settings
Crossovers between the MACD line and the signal line are trading signals; the histogram zero-cross and peaks indicate momentum shifts. The difference between the EMAs is effectively a momentum measure tied to smoothing speed.
Traders alter the EMA periods to match the time horizon: shorter EMAs make MACD react faster but increase whipsaws; longer EMAs reduce noise but delay signals.
How the Momentum indicator is constructed
Formula and step-by-step calculation
The Momentum indicator is the simplest of the three. For lookback period N:
- Momentum = CurrentPrice − PriceNPeriodsAgo (absolute form), or
- Momentum% = (CurrentPrice / PriceNPeriodsAgo) × 100 (relative form, often called Rate of Change).
There’s no smoothing built into the basic formula unless you apply a moving average to the momentum series.
Interpretation and common settings
Momentum shows the speed of price change: values above zero indicate upward momentum, below zero show downward momentum. Typical N values are 10, 14, or 21 depending on desired sensitivity.
Because it lacks smoothing, raw momentum is prone to noise; many traders apply a short MA to the momentum line or use it with MACD/RSI for confirmation.
Comparison: RSI vs MACD vs Momentum
| Characteristic | Practical difference and guidance |
| Signal type | RSI: overbought/oversold on scale; MACD: crossover and histogram momentum; Momentum: raw rate-of-change or absolute change. |
| Sensitivity control | RSI: lookback and smoothing method; MACD: EMA periods and signal smoothing; Momentum: lookback only (plus optional smoothing). |
| Scale | RSI: bounded 0–100; MACD & Momentum: unbounded, relative to price units or percentage. |
| Best use | RSI: mean-reversion and divergence; MACD: trend-following and momentum change; Momentum: early detection of speed changes and short-term accelerations. |
Practical calculations and examples
Example: computing a 14-period RSI in a spreadsheet.
- Column A: daily close. Column B: delta = A2 − A1. Columns C/D: gain = max(delta,0), loss = max(−delta,0).
- Row 15: initial avgGain = AVERAGE(C2:C15), initial avgLoss = AVERAGE(D2:D15).
- Row 16 onwards: avgGain = ((prevAvgGain * 13) + currentGain) / 14; avgLoss similar.
- RS = avgGain / avgLoss; RSI = 100 − (100 / (1 + RS)).
Example: MACD (12,26,9) in a spreadsheet uses EMA multipliers: k = 2 / (N+1). Build EMA series iteratively and subtract fast minus slow to get MACD line, then compute the signal EMA on that series.
Advanced insights (beyond common sense)
- Wilder’s RSI smoothing is mathematically equivalent to an exponentially weighted moving average (EWMA) of gains and losses; this gives RSI a memory effect that simple averages lack, affecting the persistence of extremes.
- MACD effectively measures the difference between two low-pass filters; the histogram approximates the derivative (rate of change) of the smoothed trend, so histogram peaks precede trend exhaustion signals.
- Using the same smoothing type across indicators (e.g., EMAs for MACD and EMA-smoothed RSI inputs) reduces contradictory signals caused purely by inconsistent filter responses.
- Momentum and ROC are scale-dependent: applying them on an index versus a penny stock produces different readouts; normalizing (percent ROC) lets you compare momentum across assets with different price levels.
- Divergences differ in reliability: RSI divergences on higher timeframes are statistically more robust than MACD histogram divergences on low timeframes because of lower noise and fewer false positives.
Troubleshooting common calculation and interpretation issues
I often see traders get different indicator values across platforms—here’s how I troubleshoot and fix that mismatch.
- Check the price input: confirm both platforms use the same price (close vs. typical price). Different inputs produce different EMA and RSI values.
- Verify smoothing formula: some tools implement simple moving averages where the textbook uses Wilder’s smoothing; I always check whether the implementation uses EMA-style smoothing or SMA-style smoothing.
- Confirm the lookback and alignment: ensure the lookback N and signal periods are identical and that the indicator is aligned to the same bar (some libraries output the value shifted by one bar).
- Account for initial values: EMA and Wilder averages need seed values. One platform may use zeros until enough periods accumulate; I seed initial averages with simple means to match textbook behavior.
- Watch out for timezone and session differences: daily candles from different exchanges or session definitions change the inputs; I align timezones or use UTC-based data for consistency.
If I still see discrepancies, I recreate the indicator in a spreadsheet from raw closes to validate each step; this pinpoints the exact line where implementations diverge.
Practical tips for combining indicators
Use these indicators in complementary roles rather than stacking many similar oscillators:
- Use MACD for trend/momentum direction, RSI for overbought/oversold and divergence confirmation, and Momentum for early acceleration picks.
- Match lookback lengths across indicators to your trading horizon: shorter for intraday, longer for swing trading.
- Prefer confirmation from price action and volume rather than relying solely on indicator crossovers.
Here’s an additional update , we have our own pinterest page, do check here: https://in.pinterest.com/doontradingacademy/
Conclusion
I’ve found that building indicators myself is the fastest way to understand their strengths and limitations. When I compute RSI, MACD, and Momentum from raw closes using consistent smoothing methods and aligned periods, I get fewer surprises and more actionable signals.
Step-by-step recap: compute deltas and Wilder smoothing for RSI; build EMAs and derive MACD, signal, and histogram; compute simple or percentage momentum from price N periods ago. Verify inputs, smoothing types, and alignment when troubleshooting mismatches.
If you have questions about a specific platform or want a spreadsheet template to reproduce these calculations, leave a comment and I’ll share what I use in my workflow.




