TradingView oscillator calculations

RSX indicator: compare a public formula with RSI

RSX is associated with Jurik Research, but a public script carrying that name does not establish equivalence to its proprietary algorithm. This page audits Alex Orekhov (everget)'s published Jurik RSX recurrence and compares it with Wilder RSI. It filters signed and absolute price changes separately, then forms a bounded ratio. An ordinary moving average of RSI is a different calculation.

See the decision guide

Identify the public version before comparing charts

The reference is everget's GPL-3.0 source file jurik_rsx.pine at commit 7f20cfa04e8d9873f28ea53014af4a11fef61d1b. Its default input is HLC3. The example below deliberately uses close so both oscillators receive identical inputs. LazyBear also publishes a script explicitly described as an RSX clone; its description is not proof that every public RSX script matches an official Jurik product.

  • Record the author, revision, source, length and starting history. A later script with a signal line, divergence logic or price prefilter needs a separate comparison.
  • Retain the author credit and GPL-3.0 terms when adapting this source. Access to public code does not grant access to protected or invite-only source.

Follow the two recursive branches

For length N, set a = 3/(N+2) and b = 1-a. Each stage has two states: A = b × previous A + a × input; B = a × A + b × previous B. Its output is 1.5A - 0.5B. Apply three stages separately to d = 100 × (price - previous price) and |d|. Call the final results S and M. After the reference startup gate, use clamp(50 × (1 + S/M), 0, 100) when M > 0; otherwise use 50.

  • For N = 14, the RSX stage coefficient is 0.1875, while Wilder smoothing uses approximately 0.0714286. Equal length labels do not mean equal filter response.
  • The code preserves the reference startup counters and zero-filled filter history. These are part of the version under test, not a recommended initialization policy.
CalculationState and normalizationConsequence
Public RSXThree two-state stages per branch; ratio of filtered changesThe filtered ratio can overshoot before clipping
Wilder RSIRMA of gains and losses with a = 1/N; 100 × gain/(gain + loss)Length 14 is not the RSX coefficient 3/16
Moving average of RSICalculate RSI first, then average its valuesThis order does not reproduce the public RSX recurrence

Compare the same 240 hypothetical prices

Number samples from 1. Samples 1 through 200 alternate 100, 101, starting at 100. Samples 201 through 220 are 102 through 121, increasing by one. Samples 221 through 240 are 120 through 101, decreasing by one. Both lengths are 14. Wilder averages are seeded from the first 14 actual changes; the RSX reference uses its published zero-history initialization. Values below were independently recomputed in Python, retain full precision internally, and display four decimals.

  • At sample 201, the RSI averages become gain = 0.552910 and loss = 0.447090, so 100 × gain/(gain + loss) = 55.2910. At this point the RSX output is only 51.6650.
  • The first strict cross above 70 during the rising segment occurs at sample 206 for RSX and 207 for RSI. A smoother line need not cross every threshold later.
  • After the reversal, RSI first crosses below 70 at sample 224. RSX does so at 226, two samples later and six price units below the peak. This is a specific smoothing cost in this fixture, not a universal two-bar delay.
  • RSX remains at its upper bound at sample 221 even though price has fallen. An extreme reading is a state, not a deadline for a reversal or an instruction to sell.
SamplePricePublic RSXWilder RSI
20010150.168151.8519
20110251.665055.2910
20510666.920066.7604
20610771.655969.1346
21011188.016477.0526
220121100.000089.0633
221120100.000082.7016
22411781.708466.2156
22511672.650761.4859
22611563.132057.0940
23011128.587842.4475
2401010.000020.2304

Expose startup artifacts and denominator boundaries

A constant-price test reveals why a visible value is not proof of readiness. With length 14 and every input equal to 100, the reference returns 50 for samples 1 through 5, then 100 at sample 6. Its first scaled change is 10,000 because unavailable previous price becomes zero. That artificial impulse enters both filter branches even though the observed prices never move.

  • A fixed burn-in such as 200 bars is only a test setting. Longer lengths can require more history. Compare two runs with different starting dates and a stated numerical tolerance before choosing an alert warm-up.
  • Missing data, HLC3 versus close, synthetic candles, session selection and the exchange feed can each change the input. This fixture assumes finite, uninterrupted prices; it does not specify a repair policy for missing observations.
  • Increasing prices can sustain a high oscillator reading. In the synthetic down leg, RSX reaches 0 while RSI remains above 20. The shared scale does not make their thresholds interchangeable.
Test or conditionExpected treatmentAudit implication
All input prices are zeroPublic RSX stays 50 because M is zeroFallback 50 does not prove balanced buying and selling
Flat nonzero input from startupInitial zero-to-price impulse can produce an extremeDo not infer momentum from those early values
RSI gain and loss both zeroThe comparator below returns unavailableDocument the zero policy before comparing another RSI implementation
RSX ratio outside its scaleClamp to 0 or 100Clipping can hide differences in the underlying ratio
Different loaded historyRecursive states can differ at the same timestampCompare overlapping values after extending the starting history

Inspect the public recurrence in Pine Script v6

The adaptation below preserves the reference filter and startup logic, plots a Wilder comparator with an explicit flat-series policy, and includes the synthetic fixture. Turn on the fixture with length 14 and use Sample number in the Data Window to inspect samples 200 through 240. Fixture mode continues at 101 after sample 240 and disables alerts. It is an arithmetic diagnostic, not market data.

  • For chart comparison, switch the fixture off and use ordinary candles. Add the chosen reference, set both sources to close, match length and inspect the same completed timestamps. Compare intermediate signed and absolute branches if values differ.
  • The live plots can move while a bar is open. The example alert requires a completed chart bar and a strict crossing from at least 70 to below 70 after the chosen minimum history.
  • Create the alert only after the values agree, using Once Per Bar Close. A configured minimum of 200 bars is not an automatic convergence test.
GPL-3.0 adaptation of everget's public source. Pineify syntax validation passed; the synthetic table is a separate Python calculation, not a claim of a TradingView execution test.pine
//@version=6
// Adapted from Alex Orekhov (everget), Copyright (c) 2019-present.
// GPL-3.0: https://www.gnu.org/licenses/gpl-3.0.html
// Source: github.com/everget/tradingview-pinescript-indicators/blob/7f20cfa04e8d9873f28ea53014af4a11fef61d1b/oscillators/jurik_rsx.pine
indicator("Public RSX and Wilder RSI audit", overlay=false, precision=4)
length = input.int(14, "Length", minval=2, maxval=500)
source = input.source(close, "Chart source")
fixture = input.bool(false, "Use synthetic 240-bar fixture")
float sample = bar_index < 200 ? 100 + bar_index % 2 : bar_index < 220 ? bar_index - 98 : bar_index < 240 ? 340 - bar_index : 101
price = fixture ? sample : source
stage(float value, float alpha) =>
    float filterFirst = 0.0
    float filterSecond = 0.0
    filterFirst := (1-alpha)*nz(filterFirst[1]) + alpha*value
    filterSecond := alpha*filterFirst + (1-alpha)*nz(filterSecond[1])
    1.5*filterFirst - 0.5*filterSecond
alpha = 3.0/(length+2)
scaled = 100*price
previous = nz(scaled[1])
change = scaled-previous
signed1 = stage(change, alpha)
signed2 = stage(signed1, alpha)
numerator = stage(signed2, alpha)
absolute1 = stage(math.abs(change), alpha)
absolute2 = stage(absolute1, alpha)
denominator = stage(absolute2, alpha)
float gate = 0.0
float count = 0.0
count := nz(count[1]) == 0 ? 1 : nz(gate[1]) <= nz(count[1]) ? nz(gate[1])+1 : nz(count[1])+1
gate := nz(count[1]) == 0 and length-1 >= 5 ? length-1 : 5
movement = gate >= count and scaled != previous
effectiveCount = gate == count and not movement ? 0 : count
raw = gate < effectiveCount and denominator > 0 ? 50*(1+numerator/denominator) : 50
rsx = math.max(0, math.min(100, raw))
delta = ta.change(price)
gain = ta.rma(math.max(delta, 0), length)
loss = ta.rma(math.max(-delta, 0), length)
rsi = gain+loss > 0 ? 100*gain/(gain+loss) : na
plot(rsx, "Public RSX", color=color.blue, linewidth=2)
plot(rsi, "Wilder RSI", color=color.orange)
plot(bar_index+1, "Sample number", display=display.data_window)
hline(70, "Upper reference")
hline(50, "Midpoint")
hline(30, "Lower reference")
minimumHistory = input.int(200, "Minimum bars before alert", minval=20)
crossDown = ta.crossunder(rsx, 70)
alertcondition(not fixture and bar_index+1 >= minimumHistory and barstate.isconfirmed and crossDown, "RSX exits upper region", "Public RSX crossed below 70 on a completed chart bar.")

Ask Pineify to preserve the calculation contract

Give the Pine Script AI Coding Agent the public source, author and license, input source, length, startup rules and this fixture. Ask it to retain the intermediate states while adding a confirmed-bar condition. Pineify can help draft or revise the script and check syntax; compare its numerical output in TradingView before relying on alerts.

  • Keep a raw RSX plot when adding a signal line. Record both line-cross events and time spent above or below a threshold so smoothing changes are visible.
  • Do not ask the agent to infer protected Jurik code or label an arbitrary smoothed RSI as the same algorithm. No proprietary equivalence or profitable outcome is established here.
Where Pineify fits

Pine Script AI Coding Agent

Draft a public-source RSX comparison with documented initialization, diagnostic values and confirmed-bar alerts.

Draft an RSX comparison

Frequently asked questions

Educational information, not investment advice. Synthetic examples illustrate arithmetic, not trading results. Public RSX implementations are not verified substitutes for proprietary algorithms. Oscillator levels and syntax-valid code do not guarantee 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.