TradingView indicator guides

SMI Ergodic Oscillator: Histogram Identity and Scale

This script plots the difference between ta.tsi(close, 5, 20) and its five-bar EMA. Every histogram bar is red, whether above or below zero. The sign describes the TSI-to-signal gap; it does not directly identify the direction of the current price change or a future reversal.

Inspect the Pine Script

The zero cross is the same event in another display

TradingView’s SMIO definition subtracts the EMA signal from the underlying ratio. Write E = ta.tsi(close, shortLength, longLength), S = EMA(E, signalLength), and H = E − S. This is the histogram shown below.

For the same data, initialization and parameters, H > 0 is exactly E > S. A strict upward zero crossing of H occurs on the same bar as an upward crossing of E over S, with the same previous-bar equality rule. The histogram cannot lead that line-to-line event by several bars. It can differ in timing from E crossing its own zero axis, which is a different test.

One closed-bar crossing is already a confirmed crossing if the condition holds at close. Requiring a second positive bar is an additional persistence filter, not the definition of confirmation. It delays the decision and does not guarantee a better outcome. The example has no such filter or alert condition.

Read the raw scale correctly

The ta.tsi reference gives the underlying ratio on a −1 to +1 scale when defined. The code does not multiply by 100. Therefore a claim about a raw SMIO reading of +15 cannot describe this implementation.

Let alpha = 2 / (signalLength + 1). On consecutive valid observations, S = alpha × E + (1 − alpha) × S[1], so H = (1 − alpha) × (E − S[1]). If E and the previous signal both lie within −1 to +1, then |H| is at most 2 × (1 − alpha). For signalLength 5 this is 4/3, a conservative algebraic bound, not a promised attainable extreme or a trading threshold.

The histogram does not inherit an exact −1 to +1 range merely because TSI has that range. Multiplying both E and S by 100 multiplies H by 100 without moving its zero crossings. Scaling every price by a positive constant leaves the ratio and its histogram unchanged for compatible histories; that does not make different assets equally risky.

Separate sign from slope with synthetic values

These examples begin at the signal calculation: E values and previous signal states are hypothetical, not a backtest or a reconstruction of a particular price series. Use signalLength 5, so alpha = 1/3.

EMA signal arithmetic
CaseEPrevious SNew SH
A0.600.20.4
B, after A0.30.20.2333330.066667
C, separate state−0.4−0.7−0.60.2

From A to B the underlying TSI falls, yet the histogram remains positive. In C the histogram is positive while TSI remains negative. Positive H is therefore neither proof of rising TSI nor proof that TSI is above zero.

If E stays fixed at 0.8 while S starts at 0, successive H values are 0.533333, 0.355556 and 0.237037. Shrinking bars can arise solely because the signal catches up. A steadily rising price series can eventually have TSI and signal both equal to +1, leaving H at zero. Zero does not establish a flat price or absence of directional movement.

On consecutive valid observations, H = (1 − alpha) × ((E − E[1]) + H[1]). The histogram includes a decaying previous gap as well as the current TSI change. It is not simply a price acceleration calculation.

What the copied source actually provides

The function is called with longLength 20, shortLength 5 and signalLength 5. It plots one constant-red histogram and a zero line in a separate pane. It contains no input declarations, crossover markers, alert conditions, divergence recognition, higher-timeframe requests or strategy orders. Change the source or add explicit inputs to change these lengths.

The separate Pineify Visual Editor configuration exposes three length inputs. That does not add controls to this fixed copied example. A signal length of 1 makes S equal E and H equal zero on valid observations; reducing signal length does not universally mean more useful signals.

The underlying close and histogram can change on an open bar. An extension should specify bar-close confirmation and execution timing separately. A two-bar persistence rule, a minimum absolute gap, or a trend filter must be evaluated as an additional hypothesis, not advertised with an assumed win rate.

EMA lengths are decay parameters with historical memory, not hard windows. Twenty 15-minute bars span five hours of bar intervals in a continuous session; they are not 300 bars, and the EMA still depends on earlier states. No universal 4H/daily superiority, fixed lead over MACD, or ATR-percentage reliability cutoff is established here.

  1. Match the TSI scale, inputs, chart data and initial history before comparing SMII and SMIO.
  2. Verify H equals E − S and that both displays cross on the same confirmed bars.
  3. Inspect constant-price, one-sided-change, missing-data and signalLength 1 cases.
  4. For a trading strategy, define orders, costs, exits and evaluation periods, then report reproducible results.

Pine Script v6: implementation and limits

The complete Pine source preserves the raw ta.tsi scale and subtracts its EMA signal. It has a fixed red plot and no inputs, alerts, confirmation filter or orders.

Pine Script v6
//@version=6
indicator(title="SMI Ergodic Oscillator", overlay=false, max_labels_count=500)

// SMIO: difference between True Strength Index and its EMA signal line
p_ta_smio(simple int longLength, simple int shortLength, simple int signalLength) =>
    erg = ta.tsi(close, shortLength, longLength)
    sig = ta.ema(erg, signalLength)
    osc = erg - sig
    osc

// Default: longLength=20, shortLength=5, signalLength=5
p_ind_1 = p_ta_smio(20, 5, 5)

plot(p_ind_1, title="SMIO", color=color.rgb(242, 54, 69, 0), style=plot.style_histogram)
hline(0, title="SMIO - Zero", color=#787B86)

Specify a checkable adaptation in Pineify

Ask the Pine Script AI Coding Agent for a documented raw or multiplied-by-100 scale, explicit inputs and optional confirmed-bar zero-cross alerts. Compare the histogram against the two-line version before testing strategy rules. Verify generated code and current plan access; no measured trading advantage is established here.

Open Pine Script AI Coding Agent

Educational indicator analysis. No measured trading performance is established here. Syntax validation does not prove formula equivalence, execution assumptions or profitability.

Implementation questions

No. H = E − S, so their corresponding crossings are the same event when inputs and equality rules match. TSI crossing zero is a separate condition.

No. The synthetic examples show a positive gap while TSI falls, and a positive gap while TSI remains negative.

The plot uses one fixed red color for every bar. Position relative to zero carries the sign; color is not a bullish/bearish state classification.

Bar-close confirmation and a two-bar persistence filter are different rules. A crossing can be confirmed at the first bar close; waiting adds a separate requirement.

No. It only plots the histogram and zero reference. Inputs, confirmed-bar alerts and strategy order logic require explicit additions.