Backtesting with Bollinger Bands App

Course ProjectーShiny Application and Reproducible Pitch

Charin Polpanumas
The Internet

What's it for?

  • The app is a workshop for stock backtesting using Bollinger Bands assuming no commisssion. (Data from Yahoo)

  • Backtesting is basically testing your set of rules ('strategy') against historical data and see how profitable it is.

  • You can access the app here

  • Warning: You may have to wait for plots to load/reload.

What is Bollinger Bands strategy?

  • Bollinger Bands is a strategy where one buys when price drops below the lower band and sells when it pops over the upper band.

  • The upper and lower bands (red) are moving averages of type SMA (simple), WMA (weighted), or EMA (exponential) for a given days plus/minus two standard deviations.

plot of chunk unnamed-chunk-2

What to input?

One can customize the parameters of the Bollinger bands by the sidebar input:

  • Symbol: symbol of the stock you want to backtest

  • Date Range: range of date for beginning and ending the backtest

  • Method: method for calculating the lower and upper bands: SMA (simple), WMA (weighted), EMA (exponential)

  • Moving Average Days: number of days used to calculate the moving averages

Varying these parameters gives different results and analysis.

What to make of the result?

  • Cumulative return is the total return since one begins trading. For example, a cumulative return of 0.10 means 10% total return.

  • Daily return is return on a daily basis.

  • Drawdowns are periods where the portfolio is at loss. For instance, -0.1 drawdown means one is losing 10%.

plot of chunk unnamed-chunk-3