Klinger Volume Oscillator KVO
The volume signed by the direction of the bar's typical price and scaled by its range, averaged fast and slow; the oscillator is the difference of the two, with a signal line.
It measures the flow of volume behind the price's moves.
01The study, live
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. KVO has no value on the first 55 — the bars it needs before it can answer — and its first value stands on bar 56. Its line runs between -16,349 and 19,896 on these bars, and the last value is 3,922. Counting the conditions the study declares on these bars: crosses above 0 5 times; crosses below 0 5 times; crosses above its signal line 17 times; crosses below its signal line 17 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0 on 93 bars; is below 0 on 152 bars; is above its signal line on 115 bars; is below its signal line on 130 bars.
02Its parts, named
03What you see
An oscillator of volume: it compares fast and slow averages of a volume force signed by the trend.
KVO is drawn in a pane of its own around a zero line, with its signal line beside it. The line is jagged and its numbers are large — they are volumes, signed and scaled — so its side of zero, its crossings of the signal and its shape against price are what is read, never its size.
04Where it comes from
Stephen Klinger published the Volume Oscillator in 1997. His aim was a volume measure sensitive enough for short-term turns while still reflecting the long-term flow, by signing each bar's volume with the trend of the bar's typical price and scaling it by how far the trend has run.
05The formula
For each bar: the trend is +1 if high + low + close is above the previous bar's and −1 if below. dm is the bar's range, and cm the running sum of ranges since the trend last changed. The volume force is
VF = V × | 2 dm/cm − 1| × 100 × trend
and the oscillator is a fast EMA of VF minus a slow one (34 and 55 by default), with an EMA of the result (13) as its signal.
06A worked example
Take a bar with volume 1,000 and a range (dm) of 2.0, in an up-trend whose bars so far, this one included, have ranges summing to cm = 8.0.
VF = 1,000 × |2 × (2.0 / 8.0) − 1| × 100 × (+1) = 1,000 × 0.5 × 100 = +50,000
On the first bar after the trend flips, cm restarts as the previous range plus this one: with ranges of 2.0 and 2.0, cm = 4.0 and |2 × (2.0 / 4.0) − 1| = 0 — the force of the turning bar is zero, whatever its volume.
If the fast EMA of the force stands at 31,000 and the slow at 24,500, KVO = 6,500.
On real bars: take eight with highs 21, 22, 24, 24, 25, 26, 26, 27, lows 18, 19, 20, 21, 21, 23, 23, 23, closes 20, 21, 23, 22, 24, 25, 24, 26 and volumes 100, 120, 150, 90, 140, 160, 80, 170, with periods of 2 and 4 and a signal of 2. The KVO reads 2,330.9 on the sixth bar and, after the falling seventh bar, −889.3 on the last, with its signal at −621.3.
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.
//@version=6 indicator("Klinger Volume Oscillator") fastLength = input.int(34, "Fast") slowLength = input.int(55, "Slow") signalLength = input.int(13, "Signal") hlcSum = high + low + close dm = high - low // The trend: up while high + low + close rises, down while it falls; it starts up. var float trend = 1.0 // The trend's range so far: it starts again from the last bar's range when the trend turns. var float cm = 0.0 var float fastAvg = na var float slowAvg = na var float signal = na if bar_index > 0 newTrend = hlcSum > hlcSum[1] ? 1.0 : hlcSum < hlcSum[1] ? -1.0 : trend cm := bar_index == 1 or newTrend != trend ? dm[1] + dm : cm + dm trend := newTrend // The volume force: the bar's volume, scaled by its share of the trend's range, signed by the trend. vf = cm == 0 ? 0.0 : volume * math.abs(2 * (dm / cm) - 1) * 100 * trend if bar_index == 1 // All three averages start on the first volume force, so the oscillator starts at 0. fastAvg := vf slowAvg := vf signal := 0.0 else betaFast = (fastLength - 1) / (fastLength + 1) betaSlow = (slowLength - 1) / (slowLength + 1) betaSignal = (signalLength - 1) / (signalLength + 1) fastAvg := betaFast * fastAvg + (1 - betaFast) * vf slowAvg := betaSlow * slowAvg + (1 - betaSlow) * vf signal := betaSignal * signal + (1 - betaSignal) * (fastAvg - slowAvg) kvo = fastAvg - slowAvg // Drawn once the longest average has had its whole length. ready = bar_index >= math.max(fastLength, slowLength, signalLength) plot(ready ? kvo : na, "KVO") plot(ready ? signal : na, "Signal")
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
The KVO crossing its signal, or crossing zero, is read as volume pressure shifting from one side to the other.
How the signal crossing fails. Klinger read crossings in the direction of the larger trend. The line is jagged — the volume force changes sign with every flip of a three-price sum — so crossings are frequent.
How divergence fails. A divergence between the line and price can persist for a long time while price keeps going; it describes a change in participation, and it carries no date.
09In different markets and timeframes
The Klinger oscillator is a jagged, fast volume study for short-term turns within a longer flow. Its numbers are large and unitless. On markets without a central tape its volume is a count of ticks on one feed, and it should be read as activity rather than size.
10With other studies
Read with its 13-bar signal and beside price for divergence, in the direction of the larger trend, as Klinger described.
11What it does not tell you
The Klinger oscillator is built from volume; with tick volume it describes activity, not size.
12Inputs and defaults
- 1Fast Period — 34Period of the faster smoothing of the volume force
- 2Slow Period — 55Period of the slower smoothing of the volume force
- 3Signal Period — 13Smoothing for the trigger line
- 4Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 5Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
What each input changes
- Fast PeriodThe short EMA of the volume force (34).
- Slow PeriodThe long EMA (55).
- Signal PeriodThe EMA of the oscillator drawn beside it (13).
- In use34, 55 and 13 are Klinger's.
13Limits and common misreadings
Large, unitless numbers. Its scale follows the instrument's volume; only shape and sign are read.
Tick volume. On markets without a central tape (spot forex, most CFDs) the volume is one broker's count of price changes, not traded size. The study then measures activity on that feed; two brokers give two lines.
Start-dependent for the first stretch: the running sums begin with the data.
14Conditions an alert or a strategy can watch
an event happens on one bar 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
Put KVO with its defaults under a chart; replay a trend and watch for the line making lower highs while price makes higher ones, then see how many bars the trend continued.
Open the laboratory17On pages of their own
18In Bentrix
- From the menu: a chart's Indicators button › Volume › KVO, or type KVO in its search.
- Its settings: the settings card opens when it is added; its legend's name opens it again.
19From 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": "kvo"}).
The study, as a chart files it
This is a new KVO’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": "kvo",
"settings": {
"shape": "ta",
"values": {
"optInFastPeriod": 34.0,
"optInSignalPeriod": 13.0,
"optInSlowPeriod": 55.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": "kvo",
"settings": {
"shape": "ta",
"values": {
"optInFastPeriod": 34.0,
"optInSignalPeriod": 13.0,
"optInSlowPeriod": 55.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": "kvo", "settings": {"shape": "ta", "values": {"optInFastPeriod": 34.0, "optInSignalPeriod": 13.0, "optInSlowPeriod": 55.0}}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
print("line:", line["line"])
print(" newest values:", line["values"])JavaScript
const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "kvo", "settings": { "shape": "ta", "values": { "optInFastPeriod": 34.0, "optInSignalPeriod": 13.0, "optInSlowPeriod": 55.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#
var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "kvo", ["settings"] = new Dictionary<string, object?> { ["shape"] = "ta", ["values"] = new Dictionary<string, object?> { ["optInFastPeriod"] = 34.0, ["optInSignalPeriod"] = 13.0, ["optInSlowPeriod"] = 55.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"]!}");
}Go
values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "kvo", "settings": map[string]any{"shape": "ta", "values": map[string]any{"optInFastPeriod": 34.0, "optInSignalPeriod": 13.0, "optInSlowPeriod": 55.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", "kvo", "settings", obj("shape", "ta", "values", obj("optInFastPeriod", 34.0, "optInSignalPeriod", 13.0, "optInSlowPeriod", 55.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++
auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "kvo"}, {"settings", Json::Object{{"shape", "ta"}, {"values", Json::Object{{"optInFastPeriod", 34.0}, {"optInSignalPeriod", 13.0}, {"optInSlowPeriod", 55.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" => "kvo", "settings" => Dict{String,Any}("shape" => "ta", "values" => Dict{String,Any}("optInFastPeriod" => 34.0, "optInSignalPeriod" => 13.0, "optInSlowPeriod" => 55.0))); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
println("line:", " ", line["line"])
println(" newest values:", " ", line["values"])
endR
values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "kvo", settings = list(shape = "ta", values = list(optInFastPeriod = 34.0, optInSignalPeriod = 13.0, optInSlowPeriod = 55.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")
}Rust
let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "kvo", "settings": {"shape": "ta", "values": {"optInFastPeriod": 34.0, "optInSignalPeriod": 13.0, "optInSlowPeriod": 55.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 itslinename and itsvalues;values[i]belongs to the candle attimes[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.
nullis 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:
[0.0].
line | What it is |
|---|---|
Main | the indicator's own value |
Signal | a 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 kvo: {"kvo": {"applied": "close", "convention": "talib", "kind": "kvo", "settings": {"shape": "ta", "values": {"optInFastPeriod": 34.0, "optInSignalPeriod": 13.0, "optInSlowPeriod": 55.0}}}} — its rules can name:
| Write | What it is |
|---|---|
kvo | its main line, as a value in a compare |
kvo.signal | this line, as a value in a compare |
{"cond": "kvo:level.cross_up:0"} | a condition it declares itself |
{"cond": "kvo:level.cross_down:0"} | a condition it declares itself |
{"cond": "kvo:level.above:0"} | a condition it declares itself |
{"cond": "kvo:level.below:0"} | a condition it declares itself |
{"cond": "kvo:signal.cross_up"} | a condition it declares itself |
{"cond": "kvo:signal.cross_down"} | a condition it declares itself |
{"cond": "kvo:signal.above"} | a condition it declares itself |
{"cond": "kvo:signal.below"} | a condition it declares itself |
20Sources
- Colby, Robert W. The Encyclopedia of Technical Market Indicators, 2nd ed. McGraw-Hill, 2003.
- Klinger, Stephen J. "Identifying Trends with Volume Analysis." Technical Analysis of Stocks & Commodities, December 1997.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed