Trading System: How to Code a Bollinger Band Breakout Trading System


Bollinger Bands® are a highly popular technique. Many traders believe the closer the prices move to the upper band, the more overbought the market, and the closer the prices move to the lower.

It's another thing to size up one stock from another in terms of how it will respond to the bands. The day moving average was chosen to match the Bollinger Band value, other moving average lengths may work better but will need to be tested. Email will not be published , required.

What is a 'Bollinger Band®'

BullCharts indicators and BullScript March The following is the full text from a customised price chart indicator, to draw two bands like the Bollinger Bands upper and lower bands, but at different distances.

Volatility is based on the standard deviation , which changes as volatility increases and decreases. The bands automatically widen when volatility increases and narrow when volatility decreases. This dynamic nature of Bollinger Bands also means they can be used on different securities with the standard settings. Click here to download this spreadsheet example.

Bollinger Bands consist of a middle band with two outer bands. The middle band is a simple moving average that is usually set at 20 periods. A simple moving average is used because the standard deviation formula also uses a simple moving average.

The look-back period for the standard deviation is the same as for the simple moving average. The outer bands are usually set 2 standard deviations above and below the middle band. Settings can be adjusted to suit the characteristics of particular securities or trading styles.

Bollinger recommends making small incremental adjustments to the standard deviation multiplier. Changing the number of periods for the moving average also affects the number of periods used to calculate the standard deviation. Therefore, only small adjustments are required for the standard deviation multiplier.

An increase in the moving average period would automatically increase the number of periods used to calculate the standard deviation and would also warrant an increase in the standard deviation multiplier.

Bollinger suggests increasing the standard deviation multiplier to 2. W-Bottoms were part of Arthur Merrill's work that identified 16 patterns with a basic W shape. In particular, Bollinger looks for W-Bottoms where the second low is lower than the first but holds above the lower band. There are four steps to confirm a W-Bottom with Bollinger Bands. First, a reaction low forms. This low is usually, but not always, below the lower band. Second, there is a bounce towards the middle band.

Third, there is a new price low in the security. This low holds above the lower band. The ability to hold above the lower band on the test shows less weakness on the last decline. Fourth, the pattern is confirmed with a strong move off the second low and a resistance break. First, the stock formed a reaction low in January black arrow and broke below the lower band.

Second, there was a bounce back above the middle band. Third, the stock moved below its January low and held above the lower band. Even though the 5-Feb spike low broke the lower band, Bollinger Bands are calculated using closing prices so signals should also be based on closing prices. Fourth, the stock surged with expanding volume in late February and broke above the early February high.

M-Tops were also part of Arthur Merrill's work that identified 16 patterns with a basic M shape. According to Bollinger, tops are usually more complicated and drawn out than bottoms. Double tops, head-and-shoulders patterns, and diamonds represent evolving tops. In its most basic form, an M-Top is similar to a double top.

However, the reaction highs are not always equal. The first high can be higher or lower than the second high. Bollinger suggests looking for signs of non-confirmation when a security is making new highs.

This is basically the opposite of the W-Bottom. A non-confirmation occurs with three steps. First, a security creates a reaction high above the upper band. Second, there is a pullback towards the middle band. Third, prices move above the prior high but fail to reach the upper band.

This is a warning sign. The inability of the second reaction high to reach the upper band shows waning momentum, which can foreshadow a trend reversal. Final confirmation comes with a support break or bearish indicator signal. The stock moved above the upper band in April. There was a pullback in May and then another push above Even though the stock moved above the upper band on an intraday basis, it did not CLOSE above the upper band.

The M-Top was confirmed with a support break two weeks later. Also, notice that MACD formed a bearish divergence and moved below its signal line for confirmation. Price exceeded the upper band in early September to affirm the uptrend. After a pullback below the day SMA middle Bollinger Band , the stock moved to a higher high above Despite this new high for the move, price did not exceed the upper band.

Please enable Javascript to use our menu! Alternatively navigate using sitemap. Mouse over chart captions to display trading signals. Compare our market views. The weekly Trading Diary offers fundamental analysis of the economy and technical analysis of major market indices, gold, crude oil and forex. More than , subscribers - Read it now. We do not spam. Chaikin Volatility Developed by Marc Chaikin. Look for sharp increases in volatility prior to market tops and bottoms, followed by low volatility as the market loses interest.

Twiggs Volatility Twiggs Volatility is a proprietary volatility indicator used to flag elevated market risk. A squeeze, where the bands converge into a narrow neck, often precedes a sharp price rise or fall. Bollinger Bands Bollinger Band filters are calculated using exponential moving averages. Values are compared to Bollinger Bands at 1. Trading Strategies Bollinger Bands are powerful signals.

Here are two great trading strategies: But first, let's review the key Bollinger Band trading signals. Trading Signals Microsoft is shown with 20 day Bollinger Bands at 2 standard deviations. Contracting Bands Contracting bands warn that the market is about to trend: Swings In a ranging market, a move that starts at one band normally carries through to the opposite band. Breakouts and Reversals A move outside the band indicates that the trend is strong and likely to continue.

Trends A trend that hugs one band signals a strong trend that is likely to continue. The primary trend would alert traders to treat shorter-term bear signals with caution but it is also advisable to use Twiggs Money Flow to confirm buying or selling pressure. Here day Twiggs Money Flow is oscillating above zero, indicating buying pressure despite the downward breakout. So the trade would be ignored.

The subsequent pull-back to test support in November underlines the need not to set stops at the breakout level. Exit [red arrow] on bearish divergence on Twiggs Money Flow, when the second dip crosses below zero, or if price closes below the lower Bollinger Band. Bollinger Band Trends The second strategy is a trend-following strategy I picked up from Nick Radge's book Unholy Grails , where he uses day Bollinger Bands to capture trend momentum.

The rules are simple: Enter when price closes above the upper Bollinger Band Exit when price closes below the lower Bollinger Band Nick proposes setting the upper band at 3 standard deviations and the lower band at 1 standard deviation but I am wary of this too much like curve-fitting and would stick to bands at 2 standard deviations.

Exit when price falls below the lower band in Ignore the next possible long entry signal in April because Twiggs Money Flow signals a bearish divergence. Go long in October when price closes above the upper band. But the day's close is above the band, so this was not a valid exit signal.

The olive green arrow in July , when MSFT closed above the upper band, is therefore not an entry signal as the October trade is still open. Evaluation The problem with momentum strategies is eye-watering drawdowns.