RSI Indicator on TradingView: Calculation, Signals, and Strategy Limits
The Relative Strength Index (RSI) compares smoothed upward and downward price changes. It helps describe recent momentum; it does not establish that an overbought market must fall or an oversold market must rise.
Calculation and reference levels
TradingView's RSI documentation describes Wilder's oscillator and the default 14-period calculation. Average gains and losses use Wilder-style smoothing, available as ta.rma in Pine. RS is the smoothed gain divided by the smoothed loss; RSI transforms that ratio to a 0 to 100 scale using 100 - 100 / (1 + RS).
When both smoothed quantities are positive, RSI at 50 means they are equal. The familiar 70 and 30 levels are reference thresholds, not reversal guarantees. A strong trend can keep RSI high or depressed. Check the implementation's treatment of flat or one-sided series rather than dividing by zero in a custom formula.
A 14-bar window means 14 chart bars, not always 14 days. Changing the chart timeframe changes the observations. A shorter length responds more to recent changes but also changes the number and timing of crossings; it is not automatically better for day trading or crypto.
Distinguish the signal you intend to test
| Observation | What it actually records |
|---|---|
| RSI crosses above 30 | The oscillator has returned above a selected lower threshold |
| RSI crosses below 70 | The oscillator has returned below a selected upper threshold |
| RSI crosses 50 | Smoothed relative momentum changes around the midpoint |
| Price makes a lower low while RSI makes a higher low | A regular bullish divergence under a specified pivot rule |
| Price makes a higher low while RSI makes a lower low | A hidden bullish divergence under a specified pivot rule |
These observations are hypotheses for a strategy. None defines the position size, exit, transaction costs, or execution time. Comparing two price-derived indicators also does not create independent evidence merely because both agree.
For divergence, specify how pivots are selected and when they become known. A pivot confirmed several bars later cannot be traded at its earlier plotted location. On an open bar, RSI can change before the bar closes.
Inspect the existing Pine example
The following legacy Pine v5 example expresses a threshold-crossing rule. It is an educational skeleton, not a tested profitable system.
//@version=5
strategy("Basic RSI Strategy", overlay=true)
// RSI Settings
rsi_length = input.int(14, "RSI Length")
rsi_overbought = input.int(70, "Overbought Level")
rsi_oversold = input.int(30, "Oversold Level")
// Calculate RSI
rsi = ta.rsi(close, rsi_length)
// Entry Conditions
long_condition = ta.crossover(rsi, rsi_oversold)
short_condition = ta.crossunder(rsi, rsi_overbought)
// Execute Trades
if long_condition
strategy.entry("Long", strategy.long)
if short_condition
strategy.entry("Short", strategy.short)
// Plot RSI
plot(rsi, "RSI", color=color.purple)
hline(rsi_overbought, "Overbought", color=color.red)
hline(rsi_oversold, "Oversold", color=color.green)
A long entry occurs when RSI crosses back above the lower threshold; a short entry occurs when it crosses back below the upper threshold. An opposite strategy.entry can reverse an existing position. There is no independent stop-loss, profit target, date filter, or explicit commission and slippage configuration.
The example uses overlay=true, so its RSI plot shares the price-chart pane. That is not the usual separate-pane presentation of RSI and can make the oscillator hard to read. Its length input also lacks a minimum constraint; use a positive valid length. These limitations matter even when code compiles.
Review TradingView's strategy execution documentation before interpreting fill times or reversal quantities. Historical broker-emulator fills are not live execution evidence.
Evaluate a complete rule
Record the symbol, timeframe, session, dates, source, settings, and exact strategy version. Define sizing and exits before comparing results. Include plausible costs and inspect individual fills, especially gaps and reversals.
Separate the period used to choose settings from the period used to evaluate them. Compare nearby settings and different market conditions without repeatedly selecting the best result on the evaluation sample. Win rate, profit factor, and drawdown have no universal pass threshold that proves a strategy is safe.
Pineify's Visual Editor can help configure RSI conditions and generate a script for review in TradingView. Generated code still needs compilation, behavior inspection, and strategy testing. This article makes no measured lead-time, false-signal reduction, or trading-return claim.
Does RSI above 70 mean price must reverse?
No. It describes the balance of recent smoothed changes. High readings can persist during a trend.
Is the example a complete trading strategy?
It declares a strategy and submits threshold-based entries, but leaves out independent risk exits and explicit costs. Compilation does not validate its economic performance.
Can divergence be known at the plotted pivot bar?
Only if the chosen detection rule actually has enough information then. Rules that require later bars must account for that confirmation delay.




