Bentrix Docs
HomePricingDashboard

Acceleration Bands

Trend & channelsoverlay3 linesin every package

An upper and a lower band around a simple average of the price, each widened by the bar's range relative to its size, so the bands open as bars grow wide.

It reports the three bands in price units.

01The study, live

Live figureScroll to zoom, drag the bars to pan.
bar —O — H — L — C —middle band —band —band —first value at —
Show where:

Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.

What this figure shows

The figure is computed over 300 sample bars. ACCBANDS has no value on the first 19 — the bars it needs before it can answer — and its first value stands on bar 20. Counting the conditions the study declares on these bars: price crosses above the upper band 8 times; price crosses below the lower band 6 times; price comes back inside the bands 14 times; price crosses above the middle line 11 times; price crosses below the middle line 11 times. Press a condition under the figure to see each place marked.

02Its parts, named

Warm-upno value on the first 19 bars: thestudy needs them before it cananswerThe upper banda set distance above the middleThe lower bandthe same distance below the middleThe middlean average of price: the band'scentreThe bars it readseach bar's open, high, low and close
Computed by Bentrix’s own code over the sample bars. It is drawn on once, as you reach the figure.

03What you see

Three lines over price: a moving average in the middle and a band above and below whose width follows the bars' own high-low ranges.

04Where it comes from

Price Headley described the Acceleration Bands in Big Trends in Trading (2002) as a way to see when a market moves faster than its recent bars would explain.

05The formula

Each bar's high is pushed up, and its low pushed down, by four times its range relative to its midpoint, and each is averaged over N bars (20 by default):

Upper=SMA(H·(1+4H−LH+L), N),Middle=SMA(C, N)
Lower=SMA(L·(1−4H−LH+L), N)
H, L, Cthe bar's high, low and close
Nthe period, in bars — 20 by default
SMA(x,N)the simple average of x over N bars

06A worked example

The sample bars used here are eight: closes 20, 21, 23, 22, 24, 25, 24, 26; highs 21, 22, 24, 24, 25, 26, 26, 27; lows 18, 19, 20, 21, 21, 23, 23, 23; opens 19, 20, 21, 23, 22, 24, 25, 24.

Each bar gets a width factor from its own range: 4 × (high − low) / (high + low). For the last bar that is 4 × (27 − 23) / (27 + 23) = 0.320.

The bar's upper value is its high widened by the factor, 27 × (1 + 0.320) = 35.64; its lower value is its low narrowed, 23 × (1 − 0.320) = 15.64.

With a period of 3 the bands are the simple averages of the last three such values:

  • upper = 33.46
  • middle = average of the closes = 25.00
  • lower = 16.79

07Built in Assay

The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.

THE SCRIPT’S GRAPH
//@version=6
indicator("Acceleration Bands", overlay = true)
length = input.int(20, "Length")
// How wide the bar is against its own middle price, four times over.
factor = 4 * (high - low) / (high + low)
// The upper edge averages each high pushed up by that factor; the lower edge each low pushed down.
upper = ta.sma(high * (1 + factor), length)
lower = ta.sma(low * (1 - factor), length)
middle = ta.sma(close, length)
plot(middle, "Middle")
plot(upper, "Upper")
plot(lower, "Lower")

Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.

08Readings — what traders look for

Closes outside a band. Read as a move larger than the recent bars' own ranges — Headley's acceleration.

Closes back inside. Read as the acceleration having eased.

The bands' width. Wide bands are read as large recent ranges; narrow ones as a quiet market.

How a close outside the band fails. Price Headley read a close beyond the upper band as the start of an acceleration. The bands widen with the bars' ranges, so the first wide bar of a move is often still inside, and a close outside in a quiet market can be a small move.

09In different markets and timeframes

Acceleration Bands widen with the bars' own ranges. Headley read closes outside them on weekly and daily charts as moves that had begun to accelerate.

Because the width comes from each bar's own high and low, the bands are wide on markets with long intraday swings and narrow on quiet ones without any setting being changed. In a range almost every close stays inside them; in a strong trend closes ride outside one band for many bars, which is the condition Headley looked for and not an extreme to lean against. On intraday charts the bands narrow through the quiet hours and widen at a session's open, so a close outside them early in a session is more common than at midday.

10With other studies

Read beside Bollinger Bands, which measure width from closes rather than from bar ranges.

11What it does not tell you

!

A close outside the band describes a move that already happened against an average of bars already past. It says nothing about whether the next bar continues.

12Inputs and defaults

ACCBANDS (20, Chart)settings card
1Time Period20
2TimeframeChart
3Wait for the candle to closeOn
  1. 1
    Time Period — 20Time period
  2. 2
    Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
  3. 3
    Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.

What each input changes

  • Time PeriodThe number of bars in the window. Longer: steadier and later. Shorter: quicker and noisier.
  • In use20 bars.

13Limits and common misreadings

Range, not deviation. Unlike Bollinger Bands, the width comes from the bars' high-low ranges, not from how far closes scatter; a market of wide bars with flat closes still has wide bands.

The factor of four is Headley's; it fixes how far outside the average a close must land to count.

14Conditions an alert or a strategy can watch

price crosses above the upper band eventprice crosses below the lower band eventprice comes back inside the bands eventprice crosses above the middle line eventprice crosses below the middle line event

Event: the bar it happens on an event happens on one barState: every bar while it holds a state holds on every bar while it lasts

These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.

15Practise it in the laboratory

Attach Acceleration Bands and Bollinger Bands with the same period. Step through a day and note the bars that close outside one set and not the other.

Open the laboratory

17In Bentrix

  • From the menu: a chart's Indicators button › Trend & channels › ACCBANDS, or type ACCBANDS in its search.
  • Its settings: the settings card opens when it is added; its legend's name opens it again.

18From an agent or a program

Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "acc_bands"}).

The study, as a chart files it

This is a new ACCBANDS’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.

{
  "applied": "close",
  "convention": "talib",
  "kind": "acc_bands",
  "settings": {
    "shape": "ta",
    "values": {
      "optInTimePeriod": 20.0
    }
  }
}

An agent

An agent calls the MCP tool with it:

{
  "name": "study_values",
  "arguments": {
    "bench": "bentrix://lab/\u2026/bench/\u2026",
    "symbol": "EURUSD",
    "timeframe": "H1",
    "limit": 5,
    "study": {
      "applied": "close",
      "convention": "talib",
      "kind": "acc_bands",
      "settings": {
        "shape": "ta",
        "values": {
          "optInTimePeriod": 20.0
        }
      }
    }
  }
}

A program

A program does the same in its language — bench and market as in the built-in indicators guide:

Python

values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "talib", "kind": "acc_bands", "settings": {"shape": "ta", "values": {"optInTimePeriod": 20.0}}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
    print("line:", line["line"])
    print("  newest values:", line["values"])

JSJavaScript

const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "acc_bands", "settings": { "shape": "ta", "values": { "optInTimePeriod": 20.0 } } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
  console.log("line:", line.line);
  console.log("  newest values:", line.values);
}

C#C#

var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "acc_bands", ["settings"] = new Dictionary<string, object?> { ["shape"] = "ta", ["values"] = new Dictionary<string, object?> { ["optInTimePeriod"] = 20.0 } } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
    Console.WriteLine($"line: {line!["line"]!}");
    Console.WriteLine($"  newest values: {line!["values"]!}");
}

GOGo

values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "acc_bands", "settings": map[string]any{"shape": "ta", "values": map[string]any{"optInTimePeriod": 20.0}}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
	fmt.Println("line:", at(line, "line"))
	fmt.Println("  newest values:", at(line, "values"))
}

Java

Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "talib", "kind", "acc_bands", "settings", obj("shape", "ta", "values", obj("optInTimePeriod", 20.0)))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
    System.out.println("line:" + " " + at(line, "line"));
    System.out.println("  newest values:" + " " + at(line, "values"));
}

C++C++

auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "acc_bands"}, {"settings", Json::Object{{"shape", "ta"}, {"values", Json::Object{{"optInTimePeriod", 20.0}}}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
    std::cout << "line:" << " " << line["line"].dump() << std::endl;
    std::cout << "  newest values:" << " " << line["values"].dump() << std::endl;
}

Julia

values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "talib", "kind" => "acc_bands", "settings" => Dict{String,Any}("shape" => "ta", "values" => Dict{String,Any}("optInTimePeriod" => 20.0))); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
    println("line:", " ", line["line"])
    println("  newest values:", " ", line["values"])
end

RR

values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "acc_bands", settings = list(shape = "ta", values = list(optInTimePeriod = 20.0))), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
  cat("line:", format(line$line), "\n")
  cat("  newest values:", format(line$values), "\n")
}

RRust

let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "acc_bands", "settings": {"shape": "ta", "values": {"optInTimePeriod": 20.0}}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
    println!("line: {}", line["line"]);
    println!("  newest values: {}", line["values"]);
}

Reading the answer

  • times — the candles’ open times, in milliseconds since 1970 (UTC), oldest first.
  • lines — one entry per line, in this order, each with its line name and its values; values[i] belongs to the candle at times[i].
  • The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
  • null is a candle with no value yet — the warm-up, about 1 × the period at the start of the history.
lineWhat it is
BandMidmiddle band
BandEdgeband
BandEdgeband

In a strategy

Filed under a key of your choice in a strategy document’s studies — here acc_bands: {"acc_bands": {"applied": "close", "convention": "talib", "kind": "acc_bands", "settings": {"shape": "ta", "values": {"optInTimePeriod": 20.0}}}} — its rules can name:

WriteWhat it is
acc_bands.band_midthis line, as a value in a compare
{"cond": "acc_bands:band.cross_above_upper"}a condition it declares itself
{"cond": "acc_bands:band.cross_below_lower"}a condition it declares itself
{"cond": "acc_bands:band.back_inside"}a condition it declares itself
{"cond": "acc_bands:band.mid_cross_up"}a condition it declares itself
{"cond": "acc_bands:band.mid_cross_down"}a condition it declares itself

Its lines named band_edge are more than one line of that name, so a strategy reaches them through the conditions above rather than by name.

19Sources

  1. Headley, Price. Big Trends in Trading. Wiley, 2002.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed