stratBBands: Bollinger Bands Strategy

Description Usage Indicators Signals Rules Notes References

Description

Strategy object implementing a Bollinger Bands strategy.

Usage

1
data('stratBBands')

Indicators

This strategy uses only a single indicator, comprised of the TTR function BBands. Parameters for this indicator include number of MA periods, and the size of the bands in standard deviations.

If constructed from scratch, the indicators would consist of:

moving average

a moving average parameterized by MA type (simple, exponential, Kalman, etc.) and MA periods to smooth over

upper band

the upper band constructed classically by standard deviations from the moving average, or alternately by some other upper band generating function, and parameterized chiefly by the amplitude of the band, typically number of standard deviations from the midpoint or moving average indicator

lower band

the lower band traditionally constructed to be symmetrical and opposite the upper band, but potentially constructed via a different function or parameterized differently than the upper band function

Signals

The classic Bollinger Bands strategy depends on crossover events (signals) for the upper and lower band and the midpoint.

Cl.gt.UpperBand

type sigCrossover, if the Close price is greater than the upper band value.

Cl.lt.LowerBand

type sigCrossover, if the Close price is less than the lower band value.

Cross.mid

type sigCrossover, if the price at any point crossed the midpoint moving average.

Rules

In this strategy, each signal has a corresponding entry or exit rule.

enter
  • type ruleSignal, enter a sell order at market on Cl.gt.UpperBand signal.

  • type ruleSignal, enter a buy order at market on Cl.lt.LowerBand signal.

exit
  • type ruleSignal, enter a market order to close any open position at market on Cross.mid signal.

Notes

This strategy may be improved in practice by:

References

http://www.investopedia.com/articles/trading/07/bollinger.asp

http://www.mysmp.com/technical-analysis/bollinger-bands.html

http://trading-strategies.netfirms.com/trading/bollingerbandtactics.htm


redmode/quantstrat documentation built on May 27, 2019, 4:04 a.m.