Featured -
Posted on **Wednesday, December 21, 2011, 6:21 PM GMT +1**

## Wilder’s 2-day RSI (adjusted)

A couple of months ago I introduced blog readers to my modification of Wilder’s Relative Strength Index (RSI) ( see Modified RSI(2), Buying Power and Intermediate-Term Outlook ), utilizing an underlying’s high | low | close (instead of close vs. previous close) in order to gauge the market’s strength or weakness and/or overbought | oversold conditions.

For the calculation of Wilder’s Relative Strength Index see StockCharts.com – ChartSchool.

The modification is as follows:

- Wilder’s original formula:
**Gain**= today’s close – previous’s close - my adaptation:
**Gain**= (today’s close – today’s low) + (today’s close – today’s high)

With respect to the computation of the Relative Strength Index, everything else remains unchanged.

The change (”*Gain*”) will be positive in the event the underlying closes above the midpoint of the session, otherwise negative, now quantifiying the fact (and magnitude of change) if buyers or sellers had gained the upper hand into the close.

Both indicators work best at market extremes, and regularly in order to gauge (extreme) oversold conditions only. Subject to another posting will be the market’s tendency to show some follow-through on the upside in the event these indicators are close to 100.

The question is: What is the better tell, the original or the modified formula (RSI** _{MID}**) with respect to a couple of metrics like reliability (% win / loss, avg. gain / loss, opportunity factor), robustness (usability for a specific underlying only or for different assets and asset classes) and consistency (working under specific market conditions like bull | bear markets only, or in any event). Or are they complementary ?

Let’s start with a side by side comparison: Utilizing the SPY‘s (S&P 500 SPDR), table I below shows a summary of most commonly used performance metrics with respect to the then following session in the event Wilder’s RSI or the RSI** _{MID}** finished the day below a certain threshold ( 1 | 1.5 | 2.5 | 3.5 ). ”

*Top 10*” and ”

*Bottom 10*” are reflecting the percentagewise number of setup returns falling into the Top 10% and Bottom 10% of the then current benchmark index’ returns (best and worst 10% at-any-time returns), indicating a tendency for an immediately following huge (reversal) up or (follow-through) down day.

**WILDER’S RSI vs. RSI _{MID}**

Indicator Values |
||||||||

Value |
< 1.00 |
< 1.50 |
< 2.50 |
< 3.50 |
||||

Metrics |
RSI |
RSI_{MID} |
RSI |
RSI_{MID} |
RSI |
RSI_{MID} |
RSI |
RSI_{MID} |

# occurr. | 25 | 15 | 39 | 35 | 70 | 60 | 114 | 88 |

# win | 17 | 12 | 27 | 12 | 43 | 42 | 75 | 56 |

# loss | 8 | 3 | 30 | 5 | 27 | 18 | 39 | 32 |

% win/loss | 68.00% | 80.00% | 69.23% | 85.71% | 61.43% | 70.00% | 65.79% | 63.64% |

Median | 0.61% | 0.64% | 0.56% | 0.77% | 0.24% | 0.33% | 0.31% | 0.22% |

Profit Factor | 2.83 | 2.85 | 2.14 | 6.46 | 1.61 | 2.35 | 2.34 | 2.08 |

t-score | 1.69 | 1.28 | 1.51 | 2.33 | 1.17 | 2.04 | 2.72 | 2.07 |

Top 10% | 32.00% | 20.00% | 30.77% | 22.86% | 17.14% | 23.33% | 17.54% | 18.18% |

Bottom 10% | 12.00% | 6.67% | 10.26% | 5.71% | 11.43% | 11.67% | 7.89% | 6.82% |

**Table 1**

Looking at the percentage of winning trades, the median return, the profit factor (sum of all gains divided by the sum of all losses) and risk (a small percentagewise number of occurrences in the bottom 10%) on the then following session, the RSI** _{MID}** seems to be advantageous and a better tell, but fortunately you don’t have to choose between one or the other due to the fact that only one third of the time both Wilder’s RSI and the RSI

**had been triggered at the same time in the past.**

_{MID}A streak of consecutive lower closes (and a respetive wise low 2-day RSI) doesn’t mean that the underlying always closed in the lower half of it’s daily trading range on those sessions as well. So both indicators may be used complementary, significantly increasing the opportunity factor (# of occurrences) to your potential benefit.

__________________

Utilizing the SPY‘s (S&P 500 SPDR) for the time frame from 1/1/1990 to the present (dividend and cash payments are accounted for), Figure 1 below shows the respective distribution of Wilder’s (2-day) RSI values. This distribution is by no means following a normal (Gaussian) distribution, instead (heavily) skewed on both ends (especially to the right).

It shouldn’t come as any surprise that as a due consequence you hardly ever seek any significant edge when the 2-day RSI closes at or above the 95 threshold.

__________________

**Conclusion(s)**

The RSI** _{MID}** , utilizing an underlying’s high | low | close (instead of close vs. previous close) in order to gauge the market’s strength or weakness and/or overbought | oversold conditions, seems to be an excellent addition to one’s arsenal of reliable indicators. I think there is always room for improvement, and I regularly spend a good portion of my work hours playing around (adjusting existing and/or developing new) with technical indicators.

Have a profitable week,

**Frank**

**Disclosure**: No position in the securities mentioned in this post at time of writing.

*________________________________*

**Remarks**: Due to their conceptual scope – and if not explicitly stated otherwise – , all models/setups/strategies do not account for slippage, fees and transaction costs, do not account for return on cash and/or interest on margin, do not use position sizing (e.g. Kelly, optimal f) – they’re always ‘*all in*‘ – , do not use leverage (e.g. leveraged ETFs), do not utilize any kind of abnormal market filter (e.g. during market phases with extremely elevated volatility), do not use intraday buy/sell stops (end-of-day prices only), and models/setups/strategies are not ‘*adaptive*‘ (do not adjust to the ongoing changes in market conditions like bull and bear markets). Index data (e.g. S&P 500 cash index) does not account for dividend and cash payments.

*________________________________*

**Disclaimer**

The information on this site is provided for statistical and informational purposes only. Nothing herein should be interpreted or regarded as personalized investment advice or to state or imply that past results are an indication of future performance. The author of this website is not a licensed financial advisor and will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on the content of this website(s). **Under no circumstances does this information represent an advice or recommendation to buy, sell or hold any security.**

I may or may not hold positions for myself, my family and/or clients in the securities mentioned here. Actions may have been taken before or after information is presented, and any opinions expressed in this site are subject to change without notice.

(Data courtesy of MetaStock and Pinnacle Data Corp., and for data import, testing, surveys and statistics I use **MATLAB** from MathWorks)

*________________________________*

## Comments (15)

nice work – thanks

Nice article. Looks like a techanal strategy I could add to my arsenal. I will have to see if it will work in thinkorswim.

My Christmas wish is that there was a print button on your pages to print a cleaner copy of your articles…

Ron,

thanks, and your wish is my command (I’ll do my very best to get the button work within the next couple of days).

Best,

Frank

… a couple of minutes later, and it is already up and running (see button above the ‘Category’ menue; always printing either the most recent article when activated from the home page, or the artice just showing …)

Best,

Frank

Hi,

Thanks for great post.

I am trying to replicate the numbers in the table in your post but I am missing one important piece of information: from what date onwards to which date you are using SPY? So date range (from to) is not clear to me. The closest numbers for RSI I get is if I take SPY from 1995-01-01 onwards until today. But even with this setting I get quite a bit more instances for RSI < 2.5 and RSI < 3.5 . For RSImid the numbers I get are consistently higher than yours so I guess that besides date range something else is wrong in my calculations.

Sam,

I use Pinnacle Date for SPY, going back to 1988 (probably re-calculated backwards to that date, because SPY was released for trading at a lter date). But I utilized the day range from 1/1/1990 to present.

You can either use Stockchart’S Excel spreadsheet or check your RSI data with Stockchart’s RSI(2) data in order to verify your computation. Last but not least simply substitute the original ‘Gain’ [(today’s close / yesterday’s close) – 1] by my adjusted formula. Please let me know if you need help.

I use Matlab (not Excel), therefore I can’t provide an Excel spreadsheet myself.

Best,

Frank

Frank, thnx.

I use R and TTR/quantmod/… Below is the code and results of using it. As you can see I just replaced the gains with your adjusted formula and used all other calculations for RSI as is.

library(quantmod)

library(quantstrat)

library(PerformanceAnalytics)

RSI_MID<-function(HLC, n=2, maType, …) {

rsi <- NULL

if (is.HLC(HLC)) {

HLC <- HLC(HLC)

HLC <- try.xts(HLC, error=as.matrix)

#Change up <- momentum(HLC, n=1, na.pad=TRUE) to Frank adjusted formula

up <- (Cl(HLC) – Lo(HLC)) + (Cl(HLC) – Hi(HLC))

which.dn <- which(up < 0)

dn <- up*0

dn[which.dn] <- -up[which.dn]

up[which.dn] <- 0

maArgs <- list(n=n, …)

# Default Welles Wilder EMA

if(missing(maType)) {

maType <- 'EMA'

maArgs$wilder <- TRUE

}

# Case of two different 'maType's for both MAs.

# e.g. RSI(price, n=14, maType=list(maUp=list(EMA,ratio=1/5), maDown=list(WMA,wts=1:10)) )

if( is.list(maType) ) {

# Make sure maType is a list of lists

maTypeInfo <- sapply(maType,is.list)

if( !(all(maTypeInfo) && length(maTypeInfo) == 2) ) {

stop("If \'maType\' is a list, you must specify\n ",

"*two* MAs (see Examples section of ?RSI)")

}

# If MA function has 'n' arg, see if it's populated in maType;

# if it isn't, populate it with RSI's formal 'n'

for(i in 1:length(maType)) {

if( !is.null( formals(maType[[i]])$n ) && is.null( maType[[i]]$n ) ) {

maType[[i]]$n <- n

}

mavgUp <- do.call( maType[[1]][[1]], c( list(up), maType[[1]][-1] ) )

mavgDn <- do.call( maType[[2]][[1]], c( list(dn), maType[[2]][-1] ) )

}

}

# Case of one 'maType' for both MAs.

# e.g. RSI(price, n=14, maType="WMA", wts=volume )

else {

mavgUp <- do.call( maType, c( list(up), maArgs ) )

mavgDn <- do.call( maType, c( list(dn), maArgs ) )

}

rsi <- 100 * mavgUp / ( mavgUp + mavgDn )

rsi <- reclass( rsi, HLC )

} else {

rsi <- reclass(RSI(Cl(HLC), n=n, maType=maType), HLC)

}

return(rsi)

}

getSymbols("SPY", from="1990-01-01")

SPY <- adjustOHLC(SPY)

dateFilter <- "1995/"

rsi_mid <- RSI_MID(SPY[dateFilter])

NROW(rsi_mid[rsi_mid < 1, ])

NROW(rsi_mid[rsi_mid < 1.5, ])

NROW(rsi_mid[rsi_mid < 2.5, ])

NROW(rsi_mid[rsi_mid < 3.5, ])

chart.Histogram(rsi_mid, breaks=100)

rsi <- RSI(Cl(SPY)[dateFilter], n=2)

NROW(rsi[rsi < 1, ])

NROW(rsi[rsi < 1.5, ])

NROW(rsi[rsi < 2.5, ])

NROW(rsi[rsi NROW(rsi_mid[rsi_mid NROW(rsi_mid[rsi_mid NROW(rsi_mid[rsi_mid NROW(rsi_mid[rsi_mid NROW(rsi[rsi NROW(rsi[rsi NROW(rsi[rsi NROW(rsi[rsi < 3.5, ])

[1] 128

Sam,

sorry, I don’t use R and don’t have the time to learn R in order to check your code. If your RSI data doesn’t comply with StockChart’s data, there is simply either a data (e.g. your data doesn’t account for dividend payments, or starts at another date) or programming issue (e.g. using a simple moving average for the first n-1 days, the calculation of the EMA, …).

Best,

Frank

Hello Frank

Very interesting work here, if you do not mind I have some questions:

Table 1: I am not very sure whether the performance is based on one day holding period or longer, I suppose it is one day.

Why are you also using 1, 1.5 etc as thresholds ?

I do not understand the conclusions based on the Figure 1, do you mind to give me some more hints on this graphs ?

Thanks

Ken

Ken,

1st question) “… table I below shows a summary of most commonly used performance metrics with respect to the then following session in the event …” (one day holding period)

2nd question) Simply for partly checking the indicator’s robustness. It should not work for a certain threshold only but for different underlyings and under different market conditions, and a small deviation from threshold levels should not have a significant impact on its performance figures.

3rd question) If you make a side comparison of the numer of days the 2-day RSI (SPY) closes in the 0-5, 5-10, 5-15, … 95-100 range, you’ll see that percentagewise the 90-95 and 95-100 range are on top (the is no Gaussian distribution), and we’re talking about market extremes (due to the small percentage of RSI-reading) in the 0-5 range, but regularly NOT in the 95-100 range (and while an edge on the long side might be provided in the event the 2-day RSI closes in the lowest range, no edge on the sell side is provided in the event the 2-day RSI closes in the 95-100 range).

Best,

Frank

Frank,

thanks

About the 3rd question I understand that there is an edge when the RSI value is in the lower range, table 1 shows that clearly.

What I do not understand is the conclusion that the RSI in the 90-100 range has no edge. I mean in order to affirm that you should habe also a Table 1 with RSI Values above 90 isn’t it ?

Ken

Ken,

I’am always short of time, therefore I focus on (and post about) those circumstances in the markets which might provide an edge. I could spend a lot of time in order to affirm or prove something correct which wouldn’t help anybody.

I don’t want to appear impolite, but its simply a question of focussing on the essential.

Best,

Frank

I’m not agreeing with your conclusion that the modified RSI appears to be superior (“advantageous and a better tell”). The orig. RSI is better for RSI< 1 and < 3.5, whereas the new metric (RSImid) is better for RSI < 1.5 and < 2.5. When I see discontinuous binned results like this, it suggests you don;t have enough data to determine if the two metrics actually differ in usefulness. There is no way to generate more data, but I do think one thing to at least examine would be how each one performs when it is the unique indicator — one is triggered when the other is not. The other thing (perhaps beyond your scope) is to test against more stocks and ETFs.

Hi

Can you please tell me if there is there an easy (free or cheap) way for me to run a scan for stocks using your 2 period adjusted RSI /

http://www.tradingtheodds.com/2011/12/wilders-2-day-rsi-adjusted/

I would appreciate it.

Thank you,

Robin

I’m wondering why the wins and losses on the <1.5 level in the table don't add up to the total number of occurrences. Am I reading it wrong?