ozgur_rsi

1 764
Fully English TradingView description
ozgur_rsi — Latched RSI Cycle Signals
Most RSI-based candle-colouring scripts flip the colour the moment RSI crosses 70 or 30, then flip it back the moment RSI crosses the opposite level — but in between, they look neutral. The result is that a sustained uptrend can look "quiet" for most of its life, and the chart gives no sense of which side is currently in control.
snapshot

ozgur_rsi takes a different approach: it latches the RSI cycle. Once RSI touches the upper level, the instrument stays in a bull cycle until RSI touches the lower level — and vice versa. Instead of repainting every candle, the script places a single, unambiguous BUY or SELL label at the exact bar where control changes hands. That bar is the signal; everything else is context.

How the cycle works
RSI is calculated on the chosen source with standard Wilder smoothing (ta.rsi), length 14 by default.

Cycle state starts in neutral. The first time RSI reaches the upper level (70 by default), the state switches to bull. The first time RSI reaches the lower level (30 by default), it switches to bear. After that, the state only changes when the opposite level is touched. RSI drifting back to 55 inside a bull cycle is not a signal — it is just noise.

Signals fire only on state transitions:

A BUY label appears when the state flips into a bull cycle (RSI touched the upper level after being in bear or neutral).

A SELL label appears when the state flips into a bear cycle (RSI touched the lower level after being in bull or neutral).

Signal confirmation. By default, labels are placed only on confirmed bars (barstate.isconfirmed), so a level touched mid-candle that is not held to the close does not produce a label. This is exactly what you want if you plan to act on the signal.

Where the labels sit
Each label is offset from the price candle by a multiple of ATR(14) — default 0.5× — so it does not overlap wicks:

BUY labels are drawn below the bar's low, with an upward-pointing arrow style.

SELL labels are drawn above the bar's high, with a downward-pointing arrow style.

This keeps labels clear of the price action across symbols and timeframes without hand-tuning pixel offsets. Raise the ATR multiplier on volatile instruments; lower it on quiet ones.

Each label also carries a tooltip showing the RSI value at the moment of the signal — hover over it to see the reading.

Inputs (by group)
RSI Settings
Source — source for the RSI (default: close).

RSI Length — RSI length (default 14, minimum 2).

Upper Level — RSI level that starts a bull cycle (default 70, range 50–99).

Lower Level — RSI level that starts a bear cycle (default 30, range 1–50).

Label Settings
BUY label text / SELL label text — the text shown on BUY and SELL labels (fully editable; you can change to LONG / SHORT, ▲ / ▼, etc.).

BUY color / SELL color — label background colours.

Distance from candle (x ATR) — ATR multiplier for the label offset (default 0.5).

Labels kept on chart — how many labels remain on the chart. Older labels are deleted automatically as new ones appear.

Text size — Tiny / Small / Normal / Large.

Signal Filter
Only signal on confirmed bars — when ON (default), labels appear only on confirmed bars. When OFF, labels can appear live and may move or disappear while the bar develops.

Minimum bars between signals — cooldown in bars. 0 disables it. Useful on fast timeframes where RSI oscillates around a level and produces back-to-back labels.

Alerts
Three built-in alert conditions:

BUY Signal — fires when the state flips into a bull cycle.

SELL Signal — fires when the state flips into a bear cycle.

Any Signal — fires on either transition.

For the cleanest alerts, set "Once Per Bar Close" in the alert dialog — the signal is only meaningful if it survives the close.

Live vs confirmed
On a forming bar, RSI can cross a level and flip the state, then flip back before the bar closes. If you set Only signal on confirmed bars to false, you will see this live behaviour.

With the default setting (only on confirmed bars), labels and alerts appear after the bar closes — the state and the label cannot change afterwards.

This distinction matters: the confirmed mode does not repaint. Historical labels and alerts stay exactly where they fired.

Notes and limits
RSI cycles lag price. A cycle only starts after RSI has already touched the extreme — part of the move has happened by then. This is inherent to any RSI-based method, not a flaw of the script.

The first cycle is skipped. The state starts in neutral. No label is drawn until RSI has touched one of the two levels at least once. This prevents a false BUY on the first bar of history just because RSI happens to be above 70.

ATR availability. On the first ~14 bars of loaded history, ATR is not ready. Labels still work, but their offset defaults to 0.0 on those bars — they sit directly on the candle. In practice you will not notice this because most charts load hundreds of bars.

Labels are kept across the whole chart up to the Labels kept on chart limit. Raising that number increases chart clutter but preserves history.

This indicator does not place orders. It highlights potential cycle transitions on the chart; the decision to trade remains yours.

How to use it
Bias filter. Use the current cycle to align with the prevailing side: in a bull cycle, look for longs with your own entry method; in a bear cycle, look for shorts. The signal label marks the start of the side, not the trade.

Confirmation tool. Combine with a structure or momentum tool — a BUY label at a higher-timeframe support, or a SELL label after a failed breakout, is more meaningful than one in the middle of a range.

Tune the levels. For slower, rarer signals, raise the upper level (75) and lower the lower level (25) and/or raise the RSI length. For faster signals, move the levels toward 50 (65 / 35) or shorten the RSI length. Test on your own instrument and timeframe first — every market behaves differently.

Disclaimer
This indicator is provided for education and chart analysis only. It is not financial advice, not a signal service, and not a trading system. Past behaviour does not guarantee future results. Markets carry risk and you can lose money. Always use your own risk management and test any method on your own data before relying on it.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.