Dempster-Shafer Evidence Fusion TradingView Indicator

Written by Dominic Walsh · Published

Most confluence tools add signals up and call the total a score. Also, dempster-Shafer Evidence Fusion does the algebra properly instead. This signal strength indicator TradingView traders can run in a lower pane converts six readings into belief masses across three outcomes – long, short and undecided – then fuses them pairwise with Dempster’s rule of combination. Indeed, conflict between the six gets measured rather than ignored. The pane plots long mass minus short mass.

It is free and open source. Still, you can add it to any chart from the Dempster-Shafer Evidence Fusion script page on TradingView, and the full Pine source is published there for you to read.

What Dempster-Shafer Evidence Fusion plots in a separate pane below price

The pane plots one main line: long mass minus short mass, coloured green above zero and red below. Thus, a grey zero line and two faint reference bands sit behind it. When either mass clears the threshold, the pane background tints. Hence, signals show as stacked circles at the bottom or top of the pane, tagged DSE, and the same signals mirror onto the price chart as triangles above and below the candles. A ten-row dashboard reports state, all three masses, conviction percentage, threshold, position and bars since the last signal.

How Dempster-Shafer Evidence Fusion is built

Six evidences, six mass triplets

Each child evidence produces one signed strength between -1 and +1. Next, the first takes the 21-period EMA, measures its change over 5 bars, and normalises that by ATR times the same lookback. The second takes RSI over 14 bars and rescales its distance from 50. Then, the third divides the one-bar return by ATR.

The fourth builds a signed volume z-score. Yet, it divides the bar-on-bar change in volume by the 20-bar standard deviation of volume, then signs it with the direction of the return. The fifth compares the bar range to its own 20-bar average and signs that the same way. Truly, the sixth measures where close sits inside the 20-bar high-low range, rescaled so the midpoint reads zero. Four of the six pass through a tanh squash, which keeps extreme readings bounded.

Each strength then becomes a mass triplet. Plainly, a positive strength puts mass on long, a negative one puts mass on short, and whatever certainty is missing goes to hold. Hold is the ignorance term, and a weak reading dumps nearly all of its mass there. Also, worth stating plainly: those three raw figures do not add to exactly one, so the combiner renormalises after every step.

Dempster’s rule, then the gates

The combiner takes two triplets at a time. Indeed, it first measures conflict as the long mass of one times the short mass of the other, plus the reverse. New long mass comes from long times long, plus each long paired with the other’s hold. Short mirrors it. Hold survives only where both sides stayed undecided. Still, everything divides by one minus the conflict, then by the total, so the output sums to one. That division is exactly what makes the rule interesting – two evidences that disagree hard inflate the surviving belief rather than cancelling out.

The script cascades that combiner five times to fold all six evidences into a final triplet. Thus, a signal needs long mass or short mass above the Combined Mass Threshold, 0.45 by default and adjustable from 0.40 to 0.90. Then come the ordinary gates: an optional session window that ships switched off, an internal position state that stops repeat marks in the same direction, a 5-bar cooldown, and barstate.isconfirmed.

Now the honest part. Hence, the fusion algebra is real Dempster-Shafer. The evidence feeding it is ordinary technical analysis, squashed through a tanh with no statistical calibration behind the numbers. Next, so read the long mass as a measure of agreement between six readings, not as a probability that a trade works.

How to read the signals

Watch the hold mass first. Then, it is the honest cell on the dashboard. A hold mass above 0.5 says the six evidences disagree or all sit near neutral, and the pane line will hover around zero. Yet, strong readings only mean something once hold has collapsed.

The main line is a net figure, so it hides a useful distinction. Truly, a reading of 0.3 can come from long mass 0.35 against short mass 0.05, or from 0.65 against 0.35. The first is calm agreement. The second is a fight. Plainly, the dashboard splits them out row by row.

Signals need a closed bar, so a circle lands at the open of the next candle, and the mirrored triangle on price does the same. Also, the pane background tint updates live though, so it can shade a bar that later fails to qualify. Use the tint as a warning and the circle as the mark.

Every Dempster-Shafer Evidence Fusion setting explained

The script exposes 17 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.

Calculation

SettingWhat it doesDefaultRange
EMA LengthSets the ema length used in the calculation.215 to 100
EMA LookbackSets the ema lookback used in the calculation.51 to 20
RSI LengthSets the rsi length used in the calculation.142 to 50
ATR LengthSets the atr length used in the calculation.145 to 50
Volume StDev LenSets the volume stdev len used in the calculation.205 to 100
Range Avg LengthSets the range avg length used in the calculation.205 to 100
Position-In-Range LenSets the position-in-range len used in the calculation.205 to 100

Signal Logic

SettingWhat it doesDefaultRange
Combined Mass ThresholdSets the combined mass threshold used in the calculation.0.450.4 to 0.9
Cooldown BarsSets the cooldown bars used in the calculation.51 to 60

Filters

SettingWhat it doesDefaultRange
Restrict to SessionToggles restrict to session on the chart.offon / off
Session WindowControls session window.0000-2400

Visual

SettingWhat it doesDefaultRange
Show DashboardToggles show dashboard on the chart.onon / off
Show 3-Layer GlowToggles show 3-layer glow on the chart.onon / off
Buy / Long MassColour used for buy / long mass.#39ff14
Sell / Short MassColour used for sell / short mass.#ff2d78
Hold MassColour used for hold mass.#ffaa00
Dashboard BGColour used for dashboard bg.color.new(#0a1014, 16)

Alerts built into Dempster-Shafer Evidence Fusion

The script ships 12 alert conditions. Indeed, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.

  • DSE Buy
  • DSE Sell
  • DSE Any Signal
  • DSE Long Cross
  • DSE Short Cross
  • DSE Uncertain
  • DSE High Conviction
  • DSE Net Long
  • DSE Net Short
  • DSE Webhook JSON

Other markets and timeframes

Every child evidence is dimensionless by construction. Still, slope and return divide by ATR, RSI already runs 0 to 100, range compares to its own average, and close position is a fraction of a 20-bar window. Nothing anchors to pip values, so the same defaults transfer to gold, indices, crypto and equities. Thus, the volume child is the exception. On feeds without volume the standard deviation collapses, that evidence contributes pure ignorance, and fusion simply proceeds on the other five.

Limitations worth knowing

This is a consensus meter, not a trading system. Hence, it has no stop, no target and no size logic. It also has no memory of structure – support, ranges and session context never enter the maths, so a strong long mass inside a well-worn range means far less than the same reading on a break.

Dempster’s rule assumes the evidences are independent. These are not. EMA slope, one-bar return and close-in-range all read the same trend from different angles, so agreement between them is partly baked in. Next, that pushes conviction higher than the mathematics implies, which is why the threshold sits low at 0.45 rather than near 1.

Two display details need care. Then, the two faint band lines draw at the threshold minus 0.5, so with default settings they sit close to zero and do not mark the real trigger, which tests each mass directly. And the conviction cell reports the largest of the three masses, which can be the hold mass, so a high conviction figure sometimes means confident uncertainty.

Get Dempster-Shafer Evidence Fusion on TradingView

Open Dempster-Shafer Evidence Fusion on TradingView

If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.

Get the complete indicator library

One email unlocks the full MT4 and MT5 indicator library. Yet, this TradingView script stays free on TradingView – the button above adds it to your chart.

Using it alongside MetaTrader

Adding a script on TradingView takes one click, so there is no install step here. Truly, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.

External references

Frequently asked questions

Does Dempster-Shafer Evidence Fusion repaint?

No. Plainly, both the pane circles and the mirrored triangles on price gate on barstate.isconfirmed, so they print only after the bar closes. The pane background tint is not gated, so that shading can change while a bar is still forming.

Is the long mass a probability?

No. Also, it is a belief mass from Dempster-Shafer theory, which measures how strongly six technical readings agree on one outcome. The evidences come from EMA slope, RSI, return, volume, range and close position, with no calibration against outcomes, so treat it as an agreement score.

What does the hold mass tell me?

It carries the ignorance left over once the six evidences have spoken. Indeed, high hold means weak or conflicting evidence. It falls automatically as the individual readings strengthen, which makes it a fast way to spot a market with no clear character.

Which threshold should I use?

The default 0.45 already produces selective marks because six evidences must agree to push a single mass that high. Still, raise it toward 0.6 for fewer and firmer signals. The slider stops at 0.90, which in practice almost never triggers.

How much should I rely on this indicator?

Treat it as one input, not a decision. Thus, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment