Momentum indicator: price change vs ROC
Momentum measures a price difference. Rate of Change expresses that difference as a percentage of the earlier price.
The Momentum indicator subtracts the price n bars ago from the current price. Above zero means the current source is higher than that reference; it does not mean the next bar will rise. Use the comparison below to read its units, choose a lookback and inspect confirmed zero-line signals in Pine Script v6.
What the Momentum indicator measures
For a close-based Momentum indicator, a reading of +5 means the close is five price units above the close n bars earlier. It is a net change between two observations, not a measurement of every move between them. Price can travel far in both directions and finish with Momentum near zero.
On TradingView, open Indicators, search for Momentum, and select the built-in study. Check its source and length before comparing values with another script. The example below starts with Close and 10 chart bars, with smoothing off so the raw calculation is visible.
Momentum is also a broad trading term. This page covers the difference-based MOM oscillator, rather than every momentum strategy or the separate Price Momentum Oscillator (PMO). Browse the TradingView indicators directory for other studies.
Why Traders Use This Indicator
- Measure a net price change over a specified number of chart bars.
- Separate a positive or negative reading from a one-bar zero-crossing event.
- Build an explicit momentum condition to compare with a price trend filter.
| Parameter | Default | Description |
|---|---|---|
| Momentum length | 10 in this example | The reference is 10 bars back. On a daily chart this spans 10 trading bars; on a 15-minute chart it spans 10 intraday bars, with session gaps still possible. |
| Source | Close | The source determines both endpoints. Changing to hl2 or another series changes the measurement; it does not guarantee fewer false signals. |
| Momentum smoothing | Off; SMA length 3 | Optional averaging of MOM values. It may damp fluctuations but delays or changes crossings. Smoothed MOM no longer equals the current endpoint difference. |
| Signal line | EMA 9 of displayed MOM | A separate average for comparison. Crossing this line is a different event from crossing zero. |
| Price trend filter | Off; SMA length 200 | When enabled, upward events require Close above the price SMA and downward events require Close below it. These are illustrative settings, not optimized values. |
Momentum vs ROC: formula, units and price scale
Momentum: MOM = source - source[n]. The result has the same units as the source. Pine's ta.mom reference documents the built-in function; see our ta.mom function guide for the API details.
Percentage ROC: ROC = 100 × (source - source[n]) / source[n]. See TradingView's ROC calculation. ROC is undefined when the reference value is zero. The script below returns no ROC value in that case.
| Series | Earlier price | Current price | MOM | ROC |
|---|---|---|---|---|
| A | 100 | 105 | +5 units | +5% |
| B | 1,000 | 1,005 | +5 units | +0.5% |
| C | 1,000 | 1,050 | +50 units | +5% |
A and B have equal raw Momentum but different percentage changes. A and C have equal ROC but different Momentum. Percentage normalization removes the nominal price scale; it does not adjust for volatility, leverage or risk. Match lookback, timeframe and sessions when comparing instruments. Dividing MOM by ATR measures a different quantity, movement in ATR units, rather than percentage return.
With positive reference prices, raw MOM and ROC have the same sign and zero-crossing events for identical inputs. Treating their agreement as two independent confirmations adds no new information. Negative reference prices reverse that sign relationship, so the usual percentage interpretation needs care.
Signal Interpretation
Read sign, slope and crossings separately
Positive MOM means source is above its n-bar reference. Negative MOM means it is below. A falling but positive reading remains a positive net change. There is no fixed overbought or oversold level comparable to RSI's commonly used reference bands.
An upward zero cross requires the previous MOM value to be at or below zero and the current value to be above zero. The illustrative sequence -2, 0, +1 produces an upward event only at +1. Staying above zero is a state, not a new crossing on every bar.
The reference price moves too
With a fixed n, the change in MOM equals the latest one-bar price change minus the one-bar change n bars earlier. For example, if yesterday's current/reference prices were 110/100 and today's are 111/105, MOM falls from 10 to 6 although price rises by 1. These are hypothetical endpoints. A falling MOM line alone does not establish that the latest price has fallen or a reversal has begun.
Confirm the event at bar close
The example updates its lines during an open bar but only marks and exposes alerts for crossings when that chart bar closes. This waits for a confirmed value and can miss an intrabar crossing that reverses before the close. It does not eliminate losing signals. TradingView's repainting documentation explains this distinction.
Create the alert in TradingView, choose one of the four named conditions and select Once Per Bar Close. Recreate it after changing inputs or code because running alerts use saved snapshots. See TradingView's alert documentation.
Combining with Other Indicators
The optional price SMA filter applies to both zero and signal-line crossings. An upward event must occur while Close is above the SMA; equality qualifies for neither direction. A crossing rejected by the filter is not emitted later merely because price moves above the SMA. Use moving average calculations to inspect that separate condition.
Short lookbacks often react to local oscillations; longer lookbacks compare more distant endpoints but can still produce abrupt changes when an old move leaves the window. In a range, repeated zero crosses can reverse quickly. Smoothing or trend filters change this event set and can remove useful signals too. Compare alternatives on the same data before choosing one.
On Heikin Ashi, Close is a synthetic candle value. MOM then measures a change in that synthetic series, not an executable market-price change. Use standard candles for market-price comparisons; see TradingView's non-standard chart documentation. Sources checked October 16, 2026.
Writing Pine Script Manually
Challenges of Manual Coding
Keep raw MOM in price units and ROC in percent; do not put them on one shared pane scale.
Handle unavailable history and a zero ROC denominator without substituting a misleading zero.
Compute crosses every bar, then gate markers and alerts with the same confirmation and trend conditions.
//@version=6
indicator("Momentum: price change and ROC", shorttitle="MOM rules", overlay=false)
length = input.int(10, "Momentum length", minval=1)
src = input.source(close, "Source")
useSmoothing = input.bool(false, "Smooth Momentum")
smoothLen = input.int(3, "SMA smoothing length", minval=1)
signalLen = input.int(9, "Signal EMA length", minval=1)
useTrend = input.bool(false, "Filter events with price SMA")
trendLen = input.int(200, "Price SMA length", minval=1)
showHist = input.bool(true, "Show histogram")
showZero = input.bool(true, "Show zero-cross markers")
mom = ta.mom(src, length)
smoothed = ta.sma(mom, smoothLen)
displayedMom = useSmoothing ? smoothed : mom
signal = ta.ema(displayedMom, signalLen)
trend = ta.sma(close, trendLen)
reference = src[length]
roc = not na(reference) and reference != 0 ? 100.0 * (src - reference) / reference : na
zeroUp = ta.crossover(displayedMom, 0)
zeroDown = ta.crossunder(displayedMom, 0)
signalUp = ta.crossover(displayedMom, signal)
signalDown = ta.crossunder(displayedMom, signal)
allowUp = not useTrend or close > trend
allowDown = not useTrend or close < trend
confirmedZeroUp = barstate.isconfirmed and zeroUp and allowUp
confirmedZeroDown = barstate.isconfirmed and zeroDown and allowDown
confirmedSignalUp = barstate.isconfirmed and signalUp and allowUp
confirmedSignalDown = barstate.isconfirmed and signalDown and allowDown
plot(displayedMom, "Momentum (price units)", color=color.teal, linewidth=2)
plot(signal, "Momentum signal EMA", color=color.orange)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
plot(showHist ? displayedMom : na, "Momentum histogram", style=plot.style_histogram, color=displayedMom >= 0 ? color.new(color.teal, 50) : color.new(color.orange, 50))
plotshape(showZero and confirmedZeroUp ? 0.0 : na, title="Confirmed zero up", style=shape.triangleup, location=location.absolute, color=color.green, size=size.tiny, text="0+")
plotshape(showZero and confirmedZeroDown ? 0.0 : na, title="Confirmed zero down", style=shape.triangledown, location=location.absolute, color=color.red, size=size.tiny, text="0-")
bgcolor(confirmedSignalUp ? color.new(color.green, 90) : confirmedSignalDown ? color.new(color.red, 90) : na)
plot(mom, "Raw MOM (price units)", display=display.data_window)
plot(roc, "Raw ROC (%)", display=display.data_window)
alertcondition(confirmedZeroUp, "Momentum cross above zero", "Confirmed momentum cross above zero; configured trend filter passed.")
alertcondition(confirmedZeroDown, "Momentum cross below zero", "Confirmed momentum cross below zero; configured trend filter passed.")
alertcondition(confirmedSignalUp, "Momentum cross above signal", "Confirmed momentum cross above signal; configured trend filter passed.")
alertcondition(confirmedSignalDown, "Momentum cross below signal", "Confirmed momentum cross below signal; configured trend filter passed.")
var table readings = table.new(position.top_right, 1, 3, bgcolor=color.new(color.black, 78))
if barstate.islast
table.cell(readings, 0, 0, "MOM units: " + str.tostring(displayedMom, "#.####"), text_color=color.white)
table.cell(readings, 0, 1, "Signal units: " + str.tostring(signal, "#.####"), text_color=color.white)
table.cell(readings, 0, 2, "Raw ROC %: " + str.tostring(roc, "#.####"), text_color=color.white)Maintenance Note: This is an indicator, not an order-generating strategy. ROC always uses raw source endpoints even when the displayed MOM is smoothed. Initial bars lack the required history; the live table and lines can change before the bar closes. External indicator sources may have their own repainting behavior.
Build with Pineify Visual Editor
Pineify lets you configure supported indicators and export Pine Script. Available settings and plan requirements vary by indicator. Compare the generated rules with the example before using its signals.
| Feature | Manual Pine Script | Pineify Visual Editor |
|---|---|---|
| Momentum inputs | Set source and lookback with Pine inputs. | Configure the supported MOM source and length fields. |
| Review | Inspect the calculation and each event condition in code. | Export the generated script and inspect its rules in TradingView. |
The Visual Editor includes a Momentum indicator with source and length settings.
Use the AI Coding Agent for custom changes, then review the generated conditions and check them on the chart.
Step-by-Step Tutorial
Configure Momentum
Add the supported MOM indicator in the Visual Editor. Start with Close and length 10 so its raw output can be compared with this example.
Specify the event
Define an upward zero crossing and whether price must also be above a chosen SMA. State whether the event waits for the chart bar to close.
Review custom changes
For smoothing, ROC comparison or a rule not exposed by the chosen editor controls, use the AI Coding Agent and inspect the returned Pine Script.
Check in TradingView
Export or copy the code, add it to a standard-candle chart and match the inputs. Check several endpoint differences before creating an alert.
Trading Strategies & Pro Tips
Illustrative zero-line research rule
Study upward MOM zero crosses only when Close is above SMA 200 on the same confirmed bar. A possible long-only test enters at the next bar open and exits at the next open after a confirmed MOM cross below zero. Define position size, commissions and slippage before measuring results; this page does not report a backtest.
Pro Tip: Compare with the unfiltered rule on the same sample, then evaluate a separate period not used to choose settings.
Illustrative length comparison
Compare 5-, 10- and 20-bar raw MOM on the same symbol and timeframe. Count crossings and inspect the endpoint prices. More events are not evidence of better entries, and fewer events are not evidence of lower risk.
Common Mistakes to Avoid
- Ranking symbols by raw MOM without accounting for their price scales.
- Treating positive Momentum as proof that price rose on the latest bar.
- Assuming a longer lookback or an SMA filter removes range whipsaws.
- Comparing a smoothed MOM zero cross with an unsmoothed ROC cross.
- Interpreting an indicator alert as an executable order or a tested trading system.
Frequently Asked Questions
Build and inspect a momentum rule in Pineify
- Configure the Momentum source and lookback in the Visual Editor.
- Specify zero-crossing, trend and bar-close conditions for custom code.
- Check the generated Pine Script against the chart before using alerts.
Disclaimer: Trading involves significant risk. The indicators, code, and strategies provided are for educational purposes only and do not constitute financial advice. Past performance is not indicative of future results.