The RSI, does it add value? A simple systematic test on two FX pairs
Sofien Kaabar, CFA
Institutional Technical Strategist | Author of O'Reilly's Deep Learning for Finance | Owner of the Weekly Market Sentiment Report on Substack
Keywords: Trading, price action, relative strength index, back-testing, RSI, momentum, performance, statistics, FX, technical analysis, overbought, oversold, investing, systematic, algorithmic, advisor.
An overwhelming number of traders use the famous Relative Strength Index to help with their decisions, and although it can only serve as a confirming indicator, it nevertheless, has its weight in many trading decisions or at the very least timing the decisions. The RSI has been created by J. Welles Wilder in 1978 as a momentum indicator with an optimal look-back period of 14 bars. It is bounded between 0 and 100 with 30 and 70 as the agreed-upon oversold and overbought zones respectively. The RSI can be used through 3 known techniques:
- Oversold and overbought zones as indicators of possible short-term corrections or reversals.
- Divergence from prices as an indication of trend exhaustion.
- Drawing normal supports/resistances on the indicator just as we would do with prices.
In this small study, we will be back-testing the first RSI technique and see whether touching the 30 or 70 level can provide a reversal or correction point. In other words, should we develop a system that trades when the RSI touches these levels? Below are the rules of the back-test:
- Test assets: EURUSD and USDCAD.
- Duration and time-frame: Hourly data from 2013 to date.
- Number of values: ~ 42,245
The back-tests are compared across three risk management methods:
- No stop-loss and no target orders, return is determined according the holding period. In this case 2 holding periods for the core of the study.
- Hard stop-loss and profit orders, return is determined according to pre-determined number of pips.
- ATR-based stop-loss and profit orders, return is determined following a dynamic rule of a 2x ATR(14) stop and a profit at 4x ATR(14).
We'll be breaking the convention on the RSI in this study and will test the following conditions:
- RSI period: 5 as opposed to the usual 14 or 21.
- Upper barrier (Short order is initiated when the barrier is touched): 70. Some traders use 75.
- Lower barrier (Long order is initiated when the barrier is touched): 30. Some traders use 25.
- Holding period: 2 i.e. after the signal is initiated, the position is held for a period of two hours (as the bars are hourly). In case of a hard stop or ATR stop, the sooner barrier is considered. e.g. the stop is triggered before the holding period is over.
- Elimination of duplicate orders, e.g. the RSI has two successive values under 30, prompting the algorithm to open two buy orders. The fix has been considered for this study.
After the charts, we discuss the results. Note, that the equity curve is without considering the transaction costs and the issue will be addressed later. The investment for each trade is 20,000 euros (0.2 lot for a 1:100 leverage) and the starting balance is 1,000 euros.
1 . EURUSD - No risk management
Number of data ?= 42239
Percentage of Signals = 29.57 %
Hit ratio over 42239 periods = 55.01 %
Gross return over 42239 periods = 828.0 %
Profit volatility = 26.83
Average profit = 24.02
Average loss = 27.15
Total profits = 97402.0
Total losses = -89124.0
Realized risk-reward ratio = 0.88
Expectancy = 0.01
Profit factor = 1.09
Starting balance = 1000 €
Lowest point = 664.0 €
Highest point = 9306.0 €
Final balance = 9278.0 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 8278.0 €
2. EURUSD - Hard stop-loss and profit orders at 15 pips stop and 30 pips target
Number of data ?= 42239
Percentage of Signals = 29.57 %
Hit ratio over 42239 periods = 51.0 %
Gross return over 42239 periods = 894.0 %
Profit volatility = 20.26
Average profit = 22.92
Average loss = 21.4
Total profits = 85804.0
Total losses = -76864.0
Realized risk-reward ratio = 1.07 (expected is 2.0)
Expectancy = 0.01
Profit factor = 1.12
Starting balance = 1000 €
Lowest point = 1000.0 €
Highest point = 9968.0 €
Final balance = 9940.0 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 8940.0 €
3. EURUSD - ATR-based stop-loss and profit orders
Number of data ?= 42226
Percentage of Signals = 29.51 %
Hit ratio over 42226 periods = 55.01 %
Gross return over 42226 periods = 619.0 %
Profit volatility = 26.47
Average profit = 23.17
Average loss = 26.09
Total profits = 95976.4583968
Total losses = -89786.0808554
Realized risk-reward ratio = 0.89
Expectancy = 0.01
Profit factor = 1.07
Starting balance = 1000 €
Lowest point = 615.74 €
Highest point = 7262.92 €
Final balance = 7190.38 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 6190.37 €
Conclusion: Although there are many stagnating periods where this "overly simplistic" strategy provides no value or is actually in the negative territory, the general trend seems to favor an upward skew. However, bear in mind that results are gross of any fees or slippage cost.
- USDCAD - No risk management
Number of data ?= 42255
Percentage of Signals = 29.92 %
Hit ratio over 42255 periods = 53.0 %
Gross return over 42255 periods = 817.0 %
Profit volatility = 30.04
Average profit = 25.99
Average loss = 26.78
Total profits = 101632.0
Total losses = -93460.0
Realized risk-reward ratio = 0.97
Expectancy = 0.01
Profit factor = 1.09
Starting balance = 1000 €
Lowest point = 752.0 €
Highest point = 9250.0 €
Final balance = 9172.0 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 8172.0 €
2. USDCAD - Hard stop-loss and profit orders at 15 pips stop and 30 pips target
Number of data ?= 42255
Percentage of Signals = 29.92 %
Hit ratio over 42255 periods = 49.0 %
Gross return over 42255 periods = 832.0 %
Profit volatility = 21.55
Average profit = 24.26
Average loss = 21.1
Total profits = 87928.0
Total losses = -79612.0
Realized risk-reward ratio = 1.15 (expected 2.0)
Expectancy = 0.01
Profit factor = 1.1
Starting balance = 1000 €
Lowest point = 932.0 €
Highest point = 9496.0 €
Final balance = 9316.0 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 8316.0 €
3. USDCAD - ATR-based stop-loss and profit orders
Number of data ?= 42242
Percentage of Signals = 29.93 %
Hit ratio over 42242 periods = 53.0 %
Gross return over 42242 periods = 618.0 %
Profit volatility = 28.08
Average profit = 24.94
Average loss = 25.91
Total profits = 100717.114617
Total losses = -94532.6214746
Realized risk-reward ratio = 0.96
Expectancy = 0.01
Profit factor = 1.07
Starting balance = 1000 €
Lowest point = 946.21 €
Highest point = 7291.9 €
Final balance = 7184.49 €
Holding period = 2
Total fees = 0.0 €
Total net gains = 6184.49314265 €
Conclusion: An upward sloping equity curve does not mean a good strategy, first, a simplistic strategy such as this one should not work this easily, second, costs and slippage will erode a significant amount of the above returns, and third, the algorithm assumes a utopian world where stops and profit orders are executed perfectly and entry points are timely with 0% error. One more point to mention is the short holding period, this criteria has distorted the whole image, below are the same equity curves on the USDCAD - no risk management - with holding periods ranging from 2 to 15:
In blue is the two-period holding. It is surprising to find the huge discrepancy between the rest of the holding periods.
Below is a chart with a holding period of 1 (blue) and 2 (orange) of the same RSI(5, 70, 30). It seems like the sweet spot for this indicator is a two-period strategy, but does that mean that the RSI is only good for an extremely short period of consolidation? Not really, remember that the RSI has many other usages, but the barrier method (touching the 70 and 30 area) is only good for a short set-back or rebound and that seems to fit perfectly within the 1-2 holding periods. The key word here can be "scalping" as this strategy seems to prosper in the very short-term but suffer drastically when used with a longer holding period.
A snapshot of the trading journal where the label -1 means a short position for 2 periods:
And finally, here's why this strategy is probably not tradeable: In green, our usual 2-period Utopian algorithm but in orange, it is the same algorithm with a transaction cost of 0.5 pips per trade. As soon as a small cost enters, the model becomes really bad. The power of cost management can be clearly seen here.
Disclaimer: The study reflects only my views and opinions and is not of my employer. All back-tests are not assumed to reflect the reality due to many factors that may distort the values. Back-tests should only be taken as a proxy and not an accurate measure.
-------------------------------------
RSI Calculation methodology:
As opposed to Wilder's original smoothed moving average, the exponential moving average has been used in this study (as in most trading packages).
- Taking the spread of each period: Close of current bar - Close of previous bar
- Segregating up and down period where if the current Close is higher, the up period is positive and the down period is zero.
- Calculating a rolling exponential moving average with a period N of the up and down periods.
- Calculating the ratio of the Up to Down periods, also known as the Relative Strength - RS.
- Normalizing the values between 0 and 100 using the RSI formula: