joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
330 stars 103 forks source link

Add Internal Bar Strength indicator #7

Open joshuaulrich opened 9 years ago

joshuaulrich commented 9 years ago

Internal Bar Strength (IBS) is a mean-reversion indicator described in a couple posts on the QUSMA blog.

The calculation is IBS = (Close - Low) / (High - Low), which equivalent to a 1-period stochastic oscillator with no smoothing. For example:

getSymbols("SPY")
IBS <- (Cl(SPY)-Lo(SPY))/(Hi(SPY)-Lo(SPY))
ibs <- stoch(HLC(SPY), 1)
sum(ibs$fastK - IBS, na.rm=TRUE)  # 0 (or close to it)