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.
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.")