[R-SIG-Finance] Interesting behaviour in BBands

BBands bbands at gmail.com
Fri Apr 13 22:07:06 CEST 2012


Sorry, missed this when it hit. I'd say that if standard deviation = 0
then Bollinger Bands and the derived indicators such as %b are not
defined for that period and NaN would be the correct treatment.

Best,

John Bollinger

On Sat, Feb 18, 2012 at 3:52 PM, Stergios Marinopoulos
<stergios_marinopoulos at yahoo.com> wrote:
> There's an interesting behavior in BBands when dn, mavg, and up are the same
> value.  Here's an example:
>
>
> library(quantmod);
>
> getSymbols("SPY", from="1993-01-31", to="1996-01-01" ) ;
> bb <- BBands(Cl(SPY), n=3, sd=0.3, maType=EMA) ;
>
>
> bb[bb$pctB==Inf,]
>                 dn     mavg       up pctB
> 1993-04-16 44.92297 44.92297 44.92297  Inf
> 1995-02-09 48.25296 48.25296 48.25296  Inf
>
>
> And here's the graphic display for the fist Inf occurrence:
>
>
> chartSeries(SPY["1993-04-10::1993-04-20",])
> addTA(bb,on=1)
>
>
> Notice pctB is Inf when the dn & up are coincident with mavg.  I don't think
> Inf is the right interpretation here, as the mavg line is not Inf % between
> the up and down.  Would zero be a better interpretation here?
>
>
> Thanks for your thoughts.
>
> --
> Stergios Marinopoulos
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.



More information about the R-SIG-Finance mailing list