Bentrix Docs
HomePricingDashboard

WaveTrend

Oscillatorsoscillator2 linesin every package

How far the typical price sits from its own exponential average, divided by an average of that distance, then smoothed, with a short simple average of it as the signal line.

Scaled by how far price has recently travelled, so one level reads alike in a quiet market and a fast one; it reports the oscillator and its signal, which cross, and the levels at ±53 and ±60 its author drew. Its fast length is the channel's, its slow length the average's.

01The study, live

Live figureScroll to zoom, drag the bars to pan.
-60-535360
bar —O — H — L — C —main line —signal —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. WaveTrend has no value on the first 41 — the bars it needs before it can answer — and its first value stands on bar 42. Its line runs between -84.53 and 73.66 on these bars, and the last value is 46.24. Counting the conditions the study declares on these bars: crosses above -60 4 times; crosses below -60 4 times; crosses above -53 3 times; crosses below -53 3 times; crosses above 53 4 times; crosses below 53 5 times; crosses above 60 4 times; crosses below 60 4 times. Press a condition under the figure to see each place marked. As states rather than moments: is above -60 on 192 bars; is below -60 on 67 bars; is above -53 on 175 bars; is below -53 on 84 bars; is above 53 on 59 bars; is below 53 on 200 bars.

02Its parts, named

The bars it readseach bar's open, high, low and closeWarm-upno value on the first 41 bars: thestudy needs them before it cananswerThe second linedrawn with the main line: its signalor its partnerLevel 60a fixed reference the study is readagainstLevel 53a fixed reference the study is readagainstThe main linethe study's own value on each barLevel -53a fixed reference the study is readagainst
Computed by Bentrix’s own code over the sample bars. It is drawn on once, as you reach the figure.

03What you see

Two lines in their own pane oscillating around zero, often with reference levels near ±60 and ±53. The second line is a short average of the first.

04Where it comes from

WaveTrend is a community indicator rather than one from a book: it was published as an open script by a charting community author in the 2010s, building on older channel-index ideas. Bentrix computes it from that published construction.

05The formula

From the typical price AP=(H+L+C)/3, a channel index is built and smoothed (n1=10, n2=21):

ESA=EMA(AP, n1),d=EMA(|AP−ESA|, n1)
CI=AP−ESA0.015d,WT1=EMA(CI, n2),WT2=SMA(WT1, 4)
APthe typical price, (H+L+C)/3
ESAits EMA
dthe EMA of its distance from the ESA
n1, n2the two periods — 10 and 21 by default

The constant 0.015 is the one Lambert used in the CCI.

06A worked example

Take a bar whose typical price is 101.20. The EMA of the typical price over the channel length reads 100.40, and the EMA of the absolute distances between the two reads 0.60.

CI = (101.20 − 100.40) / (0.015 × 0.60) = 0.80 / 0.009 = 88.9

That is the CCI's construction with exponential averages in place of simple ones. The WaveTrend line is an EMA of CI over the average length — if it stood at 40.0 and the average length is 21 (α = 0.0909), it moves to 40.0 + 0.0909 × (88.9 − 40.0) = 44.4. The signal is a simple average of the last four values of that line.

On real bars: take eight that rise, with highs 21, 22, 24, 24, 25, 26, 26, 27, lows 18, 19, 20, 21, 21, 23, 23, 23 and closes 20, 21, 23, 22, 24, 25, 24, 26, a channel length of 2, an average length of 3 and a signal over 2 bars. The WaveTrend line reads 46.75 on the seventh bar and 61.34 on the last, and the signal is their average, (46.75 + 61.34) / 2 = 54.05.

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("WaveTrend")
channelLength = input.int(10, "Channel")
averageLength = input.int(21, "Average")
signalLength = input.int(4, "Signal")
typical = (high + low + close) / 3
// The typical price's distance from its own exponential average...
center = ta.ema(typical, channelLength)
distance = ta.ema(math.abs(typical - center), channelLength)
// ...in units of that distance's own average, as the CCI measures it.
ci = na(distance) ? na : 0.015 * distance != 0 ? (typical - center) / (0.015 * distance) : 0.0
// The wave is that reading smoothed; the signal is a short simple average of the wave.
wave = ta.ema(ci, averageLength)
signal = ta.sma(wave, signalLength)
// Both lines start on the bar the signal has its first value.
plot(na(signal) ? na : wave, "WT1")
plot(signal, "WT2")
hline(60)
hline(-60)

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

Beyond the reference levels. Readings above about +60 or below about −60 are read as price far from its smoothed average relative to its usual distance.

The two lines crossing. Read as the smoothed channel index turning — most often noticed at the extremes.

Divergence with price, as with other oscillators. See divergenceDivergencePrice makes a new high (or low) while an oscillator does not — the move is reaching further on less momentum..

How the ±60 and ±53 levels fail. They are the author's levels for the default settings. In a strong trend the line stays at one end of its scale for a long time; a reading there describes the trend and does not mark its end.

How the crossing fails. In a market without direction the two lines cross every few bars and most crossings are followed by nothing.

09In different markets and timeframes

WaveTrend is a smoothed channel index: calmer than the CCI it is built like, and a range instrument whose levels persist in trends.

With 10 and 21 it follows swings of a few dozen bars. In a range it travels from below −60 to above +60 and back, and its two lines cross near the turns; in a trend it stays beyond ±60 on the trend's side for long stretches and the crossings there mark pauses. Its levels are conventions of the script's author and are reached more often on volatile instruments and short timeframes than on quiet ones.

10With other studies

Read with its own 4-bar signal, and beside the CCI of the channel length.

11What it does not tell you

!

It restates a smoothed CCI. An extreme reading describes past distance from an average, not a turn to come.

12Inputs and defaults

WaveTrend (10, 4)settings card
1Fast period10
2Signal period4
3Slow period21
4TimeframeChart
5Wait for the candle to closeOn
  1. 1
    Fast period — 10The channel length: the EMA of the typical price and of its distances (10).
  2. 2
    Signal period — 4The simple average of the wave drawn beside it (4).
  3. 3
    Slow period — 21The average length: the EMA that turns the raw channel index into the wave (21).
  4. 4
    Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
  5. 5
    Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.

The settings in use

  • In use10, 21 and 4 are the author's.

13Limits and common misreadings

Not a standard. Implementations differ in the averages used; compare values only with the same construction.

The levels are conventions from the script's author, not measured thresholds.

14Conditions an alert or a strategy can watch

crosses above -60 eventcrosses below -60 eventis above -60 stateis below -60 statecrosses above -53 eventcrosses below -53 eventis above -53 stateis below -53 statecrosses above 53 eventcrosses below 53 eventis above 53 stateis below 53 statecrosses above 60 eventcrosses below 60 eventis above 60 stateis below 60 statecrosses above its signal line eventcrosses below its signal line eventis above its signal line stateis below its signal line state

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 WaveTrend and CCI(20) together. Step through a swing and compare where each reached its extreme.

Open the laboratory

17In Bentrix

  • From the menu: a chart's Indicators button › Oscillators › WaveTrend, or type WaveTrend 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": "wavetrend"}).

The study, as a chart files it

This is a new WaveTrend’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": "wavetrend",
  "settings": {
    "fast": 10,
    "shape": "fast_slow_signal",
    "signal": 4,
    "slow": 21
  }
}

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": "wavetrend",
      "settings": {
        "fast": 10,
        "shape": "fast_slow_signal",
        "signal": 4,
        "slow": 21
      }
    }
  }
}

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": "wavetrend", "settings": {"fast": 10, "shape": "fast_slow_signal", "signal": 4, "slow": 21}}, 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": "wavetrend", "settings": { "fast": 10, "shape": "fast_slow_signal", "signal": 4, "slow": 21 } }, 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"] = "wavetrend", ["settings"] = new Dictionary<string, object?> { ["fast"] = 10, ["shape"] = "fast_slow_signal", ["signal"] = 4, ["slow"] = 21 } }, 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": "wavetrend", "settings": map[string]any{"fast": 10, "shape": "fast_slow_signal", "signal": 4, "slow": 21}}, 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", "wavetrend", "settings", obj("fast", 10, "shape", "fast_slow_signal", "signal", 4, "slow", 21))).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", "wavetrend"}, {"settings", Json::Object{{"fast", 10}, {"shape", "fast_slow_signal"}, {"signal", 4}, {"slow", 21}}}}).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" => "wavetrend", "settings" => Dict{String,Any}("fast" => 10, "shape" => "fast_slow_signal", "signal" => 4, "slow" => 21)); 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 = "wavetrend", settings = list(fast = 10, shape = "fast_slow_signal", signal = 4, slow = 21)), 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": "wavetrend", "settings": {"fast": 10, "shape": "fast_slow_signal", "signal": 4, "slow": 21}})).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.
  • Its fixed levels, drawn on the chart: [-60.0, -53.0, 53.0, 60.0].
lineWhat it is
Mainthe indicator's own value
Signala smoothing of the main line, drawn beside it

In a strategy

Filed under a key of your choice in a strategy document’s studies — here wavetrend: {"wavetrend": {"applied": "close", "convention": "talib", "kind": "wavetrend", "settings": {"fast": 10, "shape": "fast_slow_signal", "signal": 4, "slow": 21}}} — its rules can name:

WriteWhat it is
wavetrendits main line, as a value in a compare
wavetrend.signalthis line, as a value in a compare
{"cond": "wavetrend:level.cross_up:-60"}a condition it declares itself
{"cond": "wavetrend:level.cross_down:-60"}a condition it declares itself
{"cond": "wavetrend:level.above:-60"}a condition it declares itself
{"cond": "wavetrend:level.below:-60"}a condition it declares itself
{"cond": "wavetrend:level.cross_up:-53"}a condition it declares itself
{"cond": "wavetrend:level.cross_down:-53"}a condition it declares itself
{"cond": "wavetrend:level.above:-53"}a condition it declares itself
{"cond": "wavetrend:level.below:-53"}a condition it declares itself
{"cond": "wavetrend:level.cross_up:53"}a condition it declares itself
{"cond": "wavetrend:level.cross_down:53"}a condition it declares itself
{"cond": "wavetrend:level.above:53"}a condition it declares itself
{"cond": "wavetrend:level.below:53"}a condition it declares itself
{"cond": "wavetrend:level.cross_up:60"}a condition it declares itself
{"cond": "wavetrend:level.cross_down:60"}a condition it declares itself
{"cond": "wavetrend:level.above:60"}a condition it declares itself
{"cond": "wavetrend:level.below:60"}a condition it declares itself
{"cond": "wavetrend:signal.cross_up"}a condition it declares itself
{"cond": "wavetrend:signal.cross_down"}a condition it declares itself
{"cond": "wavetrend:signal.above"}a condition it declares itself
{"cond": "wavetrend:signal.below"}a condition it declares itself

19Sources

  1. Colby, Robert W. The Encyclopedia of Technical Market Indicators, 2nd ed. McGraw-Hill, 2003 (its components: channel index and smoothing).

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