The Pull-Back Strategy in TradingView

Coding the RSI Simple Pull-back Strategy in TradingView

Sofien Kaabar, CFA

--

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. Additionally, we can plot 50 as the middle line (or what is known as a neutrality level that splits bullish and bearish momentum).

EURAUD with the RSI

Financial pattern recognition is no easy task, and the best way to dip your toes in this field is through candlestick pattern recognition. Learn how to detect classic and modern patterns using Python in my book published with O’Reilly Media! A dedicated GitHub is provided.

Creating the Strategy

--

--