Indicators/probuilder · probacktest · proorder · proscreener

RSI

RSI in ProBuilder returns the Relative Strength Index, a 0 to 100 momentum oscillator measuring the speed and change of price movements. Syntax, formula, examples.

Syntax

probuilder
RSI[N](price)

Parameters

NameTypeDefaultDescription
Ninteger14Lookback period in bars. Shorter values such as 7 to 10 are more responsive but noisier. Longer values such as 21 to 28 smooth out signal at the cost of lag.
priceprice sourcecloseThe price stream RSI is computed on. Most common is close. Also accepts open, high, low, typicalprice, medianprice, or any custom variable.

Formula

code
RSI = 100 - (100 / (1 + RS))
where RS = AverageGain[N] / AverageLoss[N]

The averages use Wilder's smoothing, an exponential method with alpha = 1 / N. Because the denominator can never be negative, RSI is bounded between 0 and 100.

How it works

On every bar, ProBuilder takes the most recent N bar-to-bar changes in price. Positive changes contribute to the average gain, negative changes contribute to the average loss. The ratio of those two numbers, fed through the formula above, produces a value that rises as buyers dominate and falls as sellers dominate.

RSI is one of the original momentum oscillators, designed by J. Welles Wilder Jr. in 1978. Almost every other oscillator that followed (Stochastic, CCI, SMI, Money Flow Index) borrows the same general idea: compress raw price action into a bounded range so different markets become comparable.

Examples

Example 1, Smoothed RSI (Indicator)

probuilder
myRSI = RSI[14](close)
SmoothRSI = Average[10](myRSI)
RETURN myRSI, SmoothRSI coloured(121, 45, 180)

Calculates the 14-period RSI of the closing prices and applies a 10-period moving average to smooth the line. The smoothed series is rendered in purple. Smoothing reduces whipsaws at the cost of slightly slower signals.

Example 2, Long-only mean reversion in an uptrend (ProOrder)

probuilder
// Buy oversold pullbacks above the 200-period trend, exit when RSI normalises
trend = Average[200](close)
rsi   = RSI[14](close)

IF NOT LongOnMarket THEN
  IF (close > trend) AND (rsi < 30) THEN
    BUY 1 CONTRACT AT MARKET
  ENDIF
ELSE
  IF rsi > 55 THEN
    SELL AT MARKET
  ENDIF
ENDIF

A classic pullback pattern. The 200 SMA filters out short signals in downtrends, and RSI under 30 marks the pullback within the uptrend.

Example 3, Multi-timeframe RSI screener (ProScreener)

probuilder
TIMEFRAME(1 hour)
rsi1h = RSI[14](close)
TIMEFRAME(1 day, updateonclose)
rsi1d = RSI[14](close)
SCREENER[rsi1d < 35 AND rsi1h < 35](rsi1h AS "RSI 1h")

Returns only instruments oversold on both the hourly and the daily timeframe, the strongest version of the oversold setup.

Interpretation

Standard thresholds:

ZoneRangeReading
OversoldRSI < 30Recent selling has been intense relative to buying. Often, but not always, precedes a bounce.
Neutral30 to 70No strong directional momentum. The 50 line is sometimes used as a short-term bias filter.
OverboughtRSI > 70Recent buying has been intense. Can persist for a long time in strong uptrends. Do not fade blindly.

Divergences. When price makes a new high but RSI does not, or price makes a new low but RSI does not, the indicator is described as diverging from price. Some traders treat divergence as a leading signal for reversal. See the dedicated DivergenceRSI instruction for built-in detection.

Common errors and gotchas

  • Wrong bracket type. RSI(14, close) raises a syntax error. The period uses square brackets and the price source uses parentheses: RSI[14](close).
  • Trending markets break the 30 and 70 rule. In strong trends, RSI can stay above 70 or below 30 for dozens of bars in a row. Mean-reversion logic on RSI alone is the most common reason backtests look great and live results disappoint.
  • Period too short. RSI[2] or RSI[3] looks attractive in backtests because of high signal turnover, but live trading is dominated by spread and slippage. Verify with realistic costs before trusting.
  • Comparing RSI across instruments. Two instruments with the same RSI reading do not necessarily have comparable momentum. RSI normalises within an instrument's own history, not across markets.
  • DivergenceRSI, built-in divergence helper.
  • SMI, stochastic momentum index, an alternative momentum oscillator.
  • CCI, commodity channel index.
  • ROC, rate of change, a simpler momentum measure.
  • Average, used here to smooth RSI output.
  • ExponentialAverage, faster smoothing alternative.
  • Stochastic, another bounded oscillator with similar interpretation.
  • Momentum, unbounded momentum measure.