The Pull-Back Strategy in TradingView

Coding the RSI Simple Pull-back Strategy in TradingView

Sofien Kaabar, CFA
4 min readNov 27, 2023

--

Deploying strategies on the RSI is always interesting. This article presents a simple pull-back technique that does not require complex coding. The idea is presented in TradingView’s Pine Script language.

A Refresher on the RSI

First introduced by J. Welles Wilder Jr., the RSI is one of the most popular and versatile technical indicators. Mainly used as a contrarian indicator where extreme values signal a reaction that can be exploited. Typically, we use the following steps to calculate the default RSI:

  • Calculate the change in the closing prices from the previous ones.
  • Separate the positive net changes from the negative net changes.
  • Calculate a smoothed moving average on the positive net changes and on the absolute values of the negative net changes.
  • Divide the smoothed positive changes by the smoothed negative changes. We will refer to this calculation as the Relative Strength — RS.
  • Apply the normalization formula shown below for every time step to get the RSI.

The next chart shows the RSI in TradingView with 30 and 70 as oversold and overbought levels respectively…

--

--