TradingView indicator guide

Accelerator Oscillator on TradingView: formula and limits

The Accelerator Oscillator (AC) subtracts the five-bar simple moving average of the Awesome Oscillator (AO) from AO itself. With the standard inputs, AO is the 5-bar SMA of median price minus its 34-bar SMA. AC therefore measures AO relative to its recent average. A green AC column means AC rose from the previous bar; it can still be below zero. A positive AC reading can also be falling. Check value, change and bar confirmation separately when reproducing the indicator in TradingView.

Draft an AC indicator

Calculate the AO baseline, then its deviation

Bill Williams Accelerator Oscillator adds a second calculation to AO. Use median price P = (high + low) / 2, calculate AO = SMA(P, 5) − SMA(P, 34), then AC = AO − SMA(AO, 5). The last average includes the current AO observation. These are price-unit differences, with no fixed upper or lower bound.

  • Calling AC acceleration is a description of this filtered momentum calculation. It is not a literal second difference of price or proof that a price reversal will follow.
  • The formula uses historical and current inputs. A developing bar can change its high, low and resulting AC before the close.
MeasurementComparisonWhat zero means
AOFast price average minus slow price averageThe two price averages match.
ACAO minus its own recent averageAO equals its recent average.
AC changeCurrent AC minus preceding ACAC is unchanged, even if nonzero.

Recalculate a hypothetical sequence bar by bar

Assume these AO values have already been calculated: 1, 2, 3, 4, 5, 5, 4, 3, 3.5, 4. This fixture isolates the AC stage; it is not market data or a reconstruction of the earlier 34 price bars. Each row lists the five AO observations used in that row's average.

  • Bar 6: AO stays at 5, but its average rises to 3.8. AC remains positive at 1.2 and turns red because 1.2 is below 2.0. No increase in AO occurred.
  • Bar 7: AC crosses below zero even though AO remains positive at 4. The two zero lines answer different questions.
  • Bar 9: AC = 3.5 − 4.1 = −0.6. It is green because −0.6 is higher than −1.2, even though AO remains below its average.
  • Bar 10: AC crosses above zero after the first green column. A color change and a zero crossing need not occur on the same bar.
BarFive AO valuesAO averageACChange / color
51, 2, 3, 4, 53.02.0No prior AC / gray
62, 3, 4, 5, 53.81.2−0.8 / red
73, 4, 5, 5, 44.2−0.2−1.4 / red
84, 5, 5, 4, 34.2−1.2−1.0 / red
95, 5, 4, 3, 3.54.1−0.6+0.6 / green
105, 4, 3, 3.5, 43.90.1+0.7 / green

Read the sign and color as separate observations

The TradingView community implementation linked below compares each AC value with its predecessor. It assigns red to ties; this page uses gray instead so an unchanged observation is visible. That is a declared display choice, not a different AC formula. Check the source of any script you compare.

  • A smaller negative magnitude is a rising value: −0.6 is higher than −1.2. Coloring by absolute magnitude would reverse the intended comparison below zero.
  • MetaQuotes describes AC color sequences and does not treat a zero crossing alone as a trade signal. Neither a color pair nor a zero crossing specifies exits, position size or execution costs.
AC positionAC movementInterpretation
Above zeroRising / greenAO is above its average and the gap is increasing.
Above zeroFalling / redAO is above its average but the gap is narrowing.
Below zeroRising / greenAO is below its average but the gap is narrowing.
Below zeroFalling / redAO is below its average and the gap is widening.

Inspect the calculation in Pine Script v6

Paste this indicator into TradingView Pine Editor and add it to a standard candle chart. It uses chart-timeframe median prices, exposes AO, its average and AC change in the Data Window, and contains no trading orders. Keep completed-bars mode enabled for comparisons with historical bars. Disable it only to inspect the developing value.

  • At default lengths, 34 continuous valid price bars produce the first AO. Five AO observations produce the first AC on bar 38; bar 39 supplies its first change comparison. Do not replace unavailable history with zero.
  • At each completed timestamp, subtract the Data Window AO SMA from AO and compare the result with AC. Then subtract the preceding AC to verify the color.
  • With completed-bars mode enabled, the current realtime column is absent until the closing update. Calculations still run on every update; only the displayed values are gated.
  • An AO smoothing length of 1 makes AC identically zero wherever AO exists. This is a useful boundary check, not a useful momentum setting.
Calculation example with explicit tie and confirmation policies. Syntax validation does not establish trading performance or parity with every community script.pine
//@version=6
indicator("AC calculation audit", overlay = false, precision = 4)
fastLength = input.int(5, "Fast SMA bars", minval = 1)
slowLength = input.int(34, "Slow SMA bars", minval = 2)
signalLength = input.int(5, "AO smoothing bars", minval = 1)
confirmedOnly = input.bool(true, "Show completed bars only")
if fastLength >= slowLength
    runtime.error("Fast SMA length must be less than slow SMA length.")
ao = ta.sma(hl2, fastLength) - ta.sma(hl2, slowLength)
aoAverage = ta.sma(ao, signalLength)
ac = ao - aoAverage
acChange = ac - ac[1]
canShow = not confirmedOnly or barstate.isconfirmed
acColor = na(acChange) ? color.gray : acChange > 0 ? color.green : acChange < 0 ? color.red : color.gray
plot(canShow ? ac : na, "AC", color = acColor, style = plot.style_columns)
hline(0, "Zero", color = color.gray)
plot(canShow ? ao : na, "AO", display = display.data_window)
plot(canShow ? aoAverage : na, "AO SMA", display = display.data_window)
plot(canShow ? acChange : na, "AC change", display = display.data_window)

Diagnose differences before treating them as signals

A matching name is insufficient to establish matching calculations. Record the chart symbol, feed, session, timeframe, candle type, source and all three lengths. Compare completed timestamps and intermediate values before comparing column colors.

  • Raw AC amplitudes cannot be compared directly across differently priced instruments. A reading of 2 uses the chart's price units, not a universal strength scale.
  • AC can alternate around zero in uneven price sequences. Earlier changes in a filtered series do not guarantee earlier profitable entries.
Failure caseWhy it mattersCheck
Using close instead of median priceChanges both AO averages and every later AC value.Compare hl2 before checking smoothing.
Using AO − AO[1]Measures one-bar change, not deviation from a five-bar average.Bar 6 has AO change 0 but AC 1.2.
Coloring AC > 0 greenConfuses level with change.Bar 6 must be red; bar 9 must be green.
Comparing an open bar with a closed barThe open bar's high and low may still change.Match timestamps and confirmation policy.
Treating repeated flips as independent evidenceThe same rolling observations contribute to adjacent AC values.Examine the price context and evaluate explicit rules separately.

Give Pineify an auditable AC specification

Use the Pine Script AI Coding Agent to draft or explain changes to this calculation. Specify median price, the 5/34/5 lengths, chart timeframe, completed-bar confirmation and the gray tie policy. Ask it to retain the AO, AO average and AC change diagnostic outputs so each result can be checked.

  • Include the supplied AO fixture and expected AC values: 2.0, 1.2, −0.2, −1.2, −0.6, 0.1. Ask for an explanation of why bar 6 is red and bar 9 is green.
  • If adding alerts, specify whether the event is a first rising column, a sequence of rising columns or a zero crossing, and when it becomes confirmed.
  • Review generated source and validate syntax, then compare values on TradingView. Define strategy entry, exits, sizing and costs only after the indicator calculation matches.
Where Pineify fits

Pine Script AI Coding Agent

Draft or explain an Accelerator Oscillator with explicit inputs, confirmation timing and diagnostic values for bar-by-bar review.

Draft an AC indicator

Frequently asked questions

Educational information, not investment advice. The numerical sequence is hypothetical and is not a backtest. Indicator colors, zero crossings and syntax validation do not guarantee trading returns.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.