A Bollinger Band is a technical analysis tool defined by a set of trendlines plotted two standard deviations away from a simple moving average of a security’s price.
Bollinger Bands were developed and copyrighted by famous technical trader John Bollinger, designed to discover opportunities that give investors a higher probability of properly identifying when an asset is oversold or overbought.
Moving Average(ma) = SimpleMovingAverage(close, period)
Upper Band= ma+ devfactor * StandardDeviation(data, period)
Lower band = ma – devfactor * StandardDeviation(data, period)
How to use
There are three lines that compose Bollinger Bands: A simple moving average (middle band) and an upper and lower band.
The upper and lower bands are typically 2 standard deviations +/- from a 20-day simple moving average but can be modified.
Prices have a tendency to bounce within the bands’ envelope, touching one band then moving to the other band. You can use these swings to help identify potential profit targets. For example, if a price bounces off the lower band and then crosses above the moving average, the upper band then becomes the profit target.
Price can exceed or hug a band envelope for prolonged periods during strong trends. A strong trend continuation can be expected when the price moves out of the bands.
- When the price touches the lower bands, it signifies that the price is oversold and has a tendency to bounce back.
- When n the prices stay above the upper band for some time, it signifies that the uptrend is extremely strong
- When the price touches the upper bands, it signifies that the price is overbought and has a tendency to return back.
- When the prices stay below the lower band for some time, it signifies that the downtrend is extremely strong.
Building On Mudrex
As discussed above, lets first write our entry/exit conditions so that we know what to do:
BUY: When the price goes below the lower band, it signifies that the price is oversold. When it starts recovering, then one should take a long position.
Buy when price crosses up the lower band.
SELL: To close the long, wait for the price to go above the middle line, and then when the trend has exhausted, one should sell.
Sell when price crosses down the middle line
Final Strategy: The overall strategy on Mudrex looks like this
We can now run a quick back-test to see how our strategy performs.