TradingView indicator calculations

Trend Direction Force Index: normalization and thresholds

The Trend Direction Force Index (TDFI) combines changes in two smoothed price series, amplifies their average impulse, and divides the result by its recent maximum absolute value. Its sign expresses direction; its magnitude measures force relative to that particular window. A reading of 0.6 is neither a 60% return nor a 60% probability. This guide uses the public TDFI v2 implementation by causecelebre on TradingView, with its default EMA smoothers and cubic exponent, to separate those components.

See the decision guide

Separate direction, raw force and the rolling scale

For the default EMA variant, let P be the selected price multiplied by 1000. M = EMA(P, 13), S = EMA(M, 13), and a suffix p denotes the previous bar. The following equations translate the public v2 source. The variable named SMMA in that script is the second selectable smoother; its default is EMA, not necessarily Wilder smoothing.

  • Direction comes from I when D is positive. A positive separation alone cannot tell you whether momentum points up or down.
  • Changing the exponent changes the calculation. In the published version, N Length controls both the power and the normalization window: window = Lookback × N Length. An even exponent makes negative impulses nonnegative and loses the intended directional sign.
  • EMA length controls smoothing, while Lookback controls how long force extremes remain in the denominator. Increasing one is not equivalent to increasing the other.
  • The ratio is bounded only when its denominator is valid and includes the current absolute force. H = 0 produces an undefined ratio, not evidence of a tradeable neutral state.
StageEquationMeaning
Average impulse I((M − Mp) + (S − Sp)) / 2Signed average change in the two smoothed series
Separation D|M − S|Nonnegative distance between the smoothers
Raw force FD × I³Cubic impulse weighted by separation
Scale HMaximum |F| over 39 bars, including the current barRecent absolute force benchmark
TDFI TF / H, when H > 0Signed ratio between −1 and +1

Recalculate one bar before comparing colors

These are hypothetical intermediate states in scaled-price units, not observations from a traded instrument. Take M = 110, Mp = 106, S = 104 and Sp = 102. Assume the largest absolute force in the full normalization window is 810.

  • For a falling-state example, set M = 104, Mp = 108, S = 110 and Sp = 112. The impulse becomes −3, separation remains 6, force is −162 and TDFI is −0.20 with the same H.
  • If every price and corresponding EMA state is multiplied by 10, D scales by 10 and I³ by 1000. Both F and H scale by 10000, leaving T unchanged. Price units alone do not determine the normalized threshold.
  • This scale invariance assumes the same complete history, smoothers and exponent. It does not establish equal risk, equal volatility or equal signal frequency across unrelated assets.
CalculationResult
First smoother change110 − 106 = 4
Second smoother change104 − 102 = 2
Average impulse(4 + 2) / 2 = 3
Separation and force|110 − 104| × 3³ = 6 × 27 = 162
Normalized value162 / 810 = 0.20

Compare thresholds across volatility conditions

The table uses invented raw-force units to represent a quieter asset, a more volatile asset, and an asset immediately after a force shock. Each row has the same valid window length and cubic definition. These are arithmetic comparisons, not calibrated settings for forex, stocks or crypto. A directional pass means |T| exceeds the chosen threshold; it is not an order.

  • Raw force 200 can receive a smaller normalized reading than raw force 2. The denominator supplies the context; comparing the numerators alone misses it.
  • Use the same symbol, feed, timeframe, session and settings when evaluating candidate thresholds. Record the fraction of closed bars inside the neutral band and the number of new transitions outside it, then evaluate a separate period without retuning.
  • A wider neutral band reduces eligible bars on the same fixed TDFI series. It can also exclude emerging trends. No threshold in this table has demonstrated profitable trades.
Hypothetical conditionF / H = T±0.05 filter±0.20 filter
Quieter asset, steady advance2 / 20 = +0.10Positive passNo new entry
More volatile asset, proportional advance200 / 2000 = +0.10Positive passNo new entry
More volatile asset, recent large shock200 / 10000 = +0.02No new entryNo new entry
Quieter asset, downward impulse−6 / 20 = −0.30Negative passNegative pass
Any asset at the exact boundary1 / 20 = +0.05No new entryNo new entry

Why a longer window can change the signal

Consider a three-bar normalization window for a small arithmetic example. Consecutive raw forces are 100, 4, 4 and 4. At the third observation H = 100 and T = 0.04. At the fourth, the old 100 leaves the window: H = 4 and T = 1. The current raw force has not increased.

  • With a four-bar window, the fourth observation still has T = 0.04. The difference is caused entirely by the retained history.
  • A new larger absolute force immediately resets the benchmark and reaches magnitude 1. It can be negative even if the previous extreme was positive, because normalization uses absolute values.
  • After an isolated shock, a long window can keep modest later force inside the no-trade band. When the shock expires, a threshold crossing can occur without an acceleration in current impulse.
  • A constant series initialized with matching EMA states has D = I = F = 0 and H = 0. Treat that result as unavailable in an audit, and specify any alternate fallback explicitly.

Define a no-trade zone and a confirmed event

For this example policy, positive eligibility means T > 0.05, negative eligibility means T < −0.05, and −0.05 ≤ T ≤ 0.05 blocks new entries. Equality belongs to the neutral band. Missing values also block new entries. Existing-position exits require their own rule.

  • A developing bar can move from 0.04 to 0.08 and close at 0.03. A close-confirmed event does not fire in that example; an intrabar event may have fired earlier.
  • For a chart-timeframe implementation, require confirmation of the chart bar before evaluating the final alert event. TradingView documents barstate.isconfirmed as true on historical bars and on the closing update of a realtime bar.
  • A separate two-bar persistence filter would require two consecutive closed readings outside the band. It delays eligibility and must not be silently substituted for a single crossing.
Closed-bar sequenceStateNew positive event?
0.03NeutralNo
0.05Neutral boundaryNo
0.07 after 0.05Positive eligibilityYes: previous ≤ 0.05, current > 0.05
0.09 after 0.07Still positiveNo: the state continues
0.04 after 0.09Neutral againNo new entry; exit policy is separate

Keep Elder Force Index and TDFI variants separate

TradingView defines raw Elder Force Index as (current close − previous close) × current volume, with an EMA used for its smoothed form. The default EMA/EMA TDFI calculation above has no volume input and normalizes a different numerator.

  • The public TDFI v2 script also offers VWMA. Selecting it makes volume part of the smoothing, so the claim that every TDFI variant ignores volume would be incorrect.
  • A script with the same title may use different smoothers, exponent, source, window or fallback. Record its author and version before comparing results.
  • Neither indicator reveals who initiated individual trades. A positive value is not evidence that a specific institution bought the asset.

Turn the verified calculation into a Pineify request

Use the Pine Script AI Coding Agent to draft or inspect a script from these public equations. Supply the author link, EMA/EMA lengths, cubic exponent, normalization window, initialization policy and the exact closed-bar event. Ask for intermediate values in the Data Window so a mismatch can be located before adding alerts.

  • For a new audit implementation, explicitly choose EMA seeds, require a full window of valid raw-force values, and return unavailable when H is zero. These policies may differ from the early-history behavior of the original script; compare after sufficient history and document the difference.
  • Check the first valid bar, an all-zero window, both signs, an old extreme leaving the window and exact threshold equality. Compare completed TradingView bars using identical market inputs and loaded history.
  • Review generated code and run syntax validation. Then compare M, S, I, F, H and T numerically before creating alerts. Syntax success does not prove numerical parity, and this workflow does not promise to reproduce protected scripts.
Where Pineify fits

Pine Script AI Coding Agent

Draft a TDFI audit with explicit smoothing, normalization, initialization and alert conditions that you can compare with TradingView.

Draft a TDFI calculation audit

Frequently asked questions

Educational information, not investment advice. Every numerical example is hypothetical and is not a backtest. Threshold eligibility does not specify position size, exits, execution costs or expected 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.