TradingView indicator calculations

Klinger Oscillator indicator: verify the Volume Force formula

The Klinger Oscillator indicator subtracts a slow EMA of Volume Force from a fast EMA. Volume Force combines volume, the high-low range, and a trend determined by high + low + close. Common lengths are 34 and 55, with a 13-period signal EMA. Before comparing TradingView scripts, check the exact Volume Force expression and equal-price rule: published versions disagree.

Build a Klinger calculation

Choose a version before checking chart values

Klinger's 1997 article describes keeping the previous trend on an equal price sum, although its Excel sidebar assigns -1 in that case. Its Volume Force formula uses abs(2 × DM / CM - 1). TradingView's help page assigns -1 on equality and prints 2 × ((DM / CM) - 1), without an absolute value. Those expressions are not equivalent. This page follows the article's narrative trend rule and its absolute-value force formula; it does not claim to reproduce TradingView's current built-in source.

  • A second absolute value around the entire VF expression erases the negative sign on downtrends. It is a different calculation.
  • A formula using only signed volume, with no DM or CM, omits the range weighting. Matching its 34/55 lengths cannot make it equivalent to this version.
Expression when DM / CM = 1/4Factor before V × T × 100
abs(2 × DM / CM - 1), used here0.5
2 × abs(DM / CM - 1), different parentheses1.5
2 × ((DM / CM) - 1), help-page text-1.5

Compute trend, range, and cumulative measurement

Let S = H + L + C and DM = H - L. Set T to +1 when S rises and -1 when S falls; retain T when S is unchanged. If T matches the preceding trend, CM = previous CM + DM. On a reversal, CM = previous DM + current DM. Then calculate VF = V × abs(2 × DM / CM - 1) × T × 100.

  • The reversal includes two ranges. Resetting CM to current DM alone changes the force on that bar.
  • Using HLC3 instead of the sum gives the same ordering when both are computed from identical prices. Comparing close alone changes the trend test.
  • This fixture starts A with T = +1 and CM = DM. That arbitrary seed is disclosed so every row can be reproduced; it is not an inferred trend before the available history.

Nine invented bars for an implementation check

Use these completed standard bars in order, with volume in arbitrary units. A is the first available bar. Open is unnecessary for this formula. E has unavailable volume, while I has an observed zero. Prices remain available throughout. Retain the price-derived trend and CM even when volume is missing.

BarHighLowCloseVolume
A1089100
B11910120
C12810120
D1078140
E978Unavailable
F888100
G999100
H1089100
I119100

Check intermediate values before smoothing

C keeps the positive trend because S remains 30. D reverses: CM = 4 + 3 = 7, giving VF = 140 × abs(6/7 - 1) × (-1) × 100 = -2,000. F has zero range but a positive CM, so its force is -10,000. A zero range alone does not imply zero force.

  • At C, assigning -1 on equality instead would reset CM to 2 + 4 = 6 and produce VF = -4,000 under the same absolute-value formula. The disagreement starts before either EMA.
  • At G, two consecutive zero ranges meet a reversal: CM = 0 + 0. Reject the division, including when volume is also zero; multiplying an undefined ratio by zero does not repair it.
BarSTDMCMVF
A27+1 seed2210,000
B30+1240
C30+1 held480
D25-1 reversal37-2,000
E24-129Unavailable: volume
F24-1 held09-10,000
G27+1 reversal00Unavailable: CM = 0
H27+1 held2210,000
I30+1240

Verify both EMAs and the signal separately

For length N, update E = previous E + (2 / (N + 1)) × (current input - previous E). KO = EMA34(VF) - EMA55(VF); the signal is EMA13(KO). This fixture seeds both force EMAs from the first valid VF and seeds the signal at zero. An unavailable VF clears all three smoothing states; the next valid VF starts a new segment. This reset policy is a deliberate example rule, not a claim about a platform default.

  • Keep full precision between bars; the table rounds only the display. For B, EMA34 = 10,000 + (2/35) × (0 - 10,000).
  • A 13-period SMA signal has a finite window and different initialization. It cannot be compared as if it were EMA13. A histogram of KO minus signal is also different from the KO line.
  • Klinger's spreadsheet prints rounded EMA coefficients. Exact 2/(N+1), a different starting history, or an SMA seed can produce small numerical differences even with identical VF.
  • A fresh segment is not a warmed-up indicator. Suppress crossover alerts on its seed bar and define the required consecutive valid history before using later values.
BarEMA34EMA55KOSignal EMA13
A10,000.000010,000.00000.00000.0000
B9,428.57149,642.8571-214.2857-30.6122
C8,889.79599,298.4694-408.6735-84.6210
D8,267.52198,894.9526-627.4308-162.1652
EUnavailableUnavailableUnavailableUnavailable
F-10,000.0000-10,000.00000.00000.0000
GUnavailableUnavailableUnavailableUnavailable
H10,000.000010,000.00000.00000.0000
I9,428.57149,642.8571-214.2857-30.6122

Missing volume and chart confirmation need explicit rules

Unavailable volume is not observed zero volume. The fixture resets smoothing at E to avoid presenting a continuous series across an unknown force. A script that skips the missing input or carries its EMA state forward uses another policy and must say so. When price fields are unavailable, invalidate the price state too and specify a fresh initialization procedure.

  • For a zero-volume bar with valid prices and CM > 0, VF is zero and the EMAs still update. I demonstrates that behavior.
  • Compare the same symbol, feed, timeframe, session, adjustment settings, and bar type. Volume units affect force magnitude, so absolute KO levels are not universal thresholds.
  • A live bar can change its high, low, close, and volume. For close-confirmed conditions, evaluate only after the bar is confirmed; this delays the decision and does not guarantee a successful trade.
  • A signal crossover compares KO with its signal; a zero crossing compares KO with zero. Record them as separate conditions. Divergence needs a defined pivot and confirmation rule and can precede no reversal at all.

Give Pineify the version and the acceptance rows

Ask the Pine Script AI Coding Agent to draft this calculation with configurable 34/55/13 lengths, intermediate T/DM/CM/VF values, and an explicit bar-confirmation requirement. Supply the tables and state whether missing VF resets or pauses the smoothing. Compare the intermediate values first, then the oscillator, signal, and alert timestamps.

  • Require syntax validation of the generated script and inspect the final source. A successful syntax check does not prove the numerical contract.
  • Define a minimum valid-history requirement after each reset. Do not interpret the seed value of zero as a zero-line crossing.
  • If converting the indicator into a strategy, separately define entries, exits, position size, order timing, commissions, and slippage. No parameter set or profitable outcome is established by this example.
Where Pineify fits

Pine Script AI Coding Agent

Draft a Klinger indicator from an explicit formula, initialization rule, and confirmation policy, then compare its intermediate values with the arithmetic fixture.

Build a Klinger calculation

Frequently asked questions

Educational calculation example, not investment advice. The bars are hypothetical and the initialization and missing-data policies are explicit demonstration choices. Indicator agreement and syntax validation do not establish trading performance.

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.