Algorithmic Trading in Python: Bollinger Bands
Bollinger Bands are a type 什麼是布林通道(Bollinger Band) of technical analysis indicator created by John Bollinger. The bands serve as a trading envelope that provide a feel for a relative measurement for high and low points that can be used as overbought and oversold levels.
Bollinger Bands typically include two boundary lines (upper and lower bands) and one moving average line (simple moving average).
Setting up a Bollinger Band with Python
Created in the early 80s and named after its developer (pictured above), Bollinger Bands represent a key technical 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) trading tool for financial traders. Bollinger bands are plotted by two (什麼是布林通道(Bollinger Band) 2) standard deviations (a measure of volatility) away from the moving average 什麼是布林通道(Bollinger Band) of a price. Bollinger Bands allow traders to monitor and take advantage of shifts in…
Bollinger Bands Width (BBW)
Bollinger Bands Width (BBW) is a technical analysis indicator derived from the standard Bollinger Bands indicator. Bollinger 什麼是布林通道(Bollinger Band) Bands are a volatility indicator which creates a band of three lines which are plotted in relation to a security's price. The Middle Line is typically a 20 Day Simple Moving Average. The Upper and Lower Bands are typically 2 standard deviations above and below the SMA (Middle Line). Bollinger Bands Width serve as a way to quantitatively measure the width between the Upper and Lower Bands. BBW can be used to identify trading signals in some instances.
The creator of Bollinger Bands, John Bollinger, introduced Bollinger Bands Width in 2010 almost 3 decades after the introduction of his Bollinger Bands.
Bollinger Bands Width (BBW) uses the given calculation and outputs a Percentage Difference between the Upper Band and the Lower Band. This value is used to define the narrowness of the bands. What needs to be understood however is that a trader cannot simply look at the BBW value and determine if the Band is truly narrow or not. The significance of an instruments relative narrowness changes depending on the instrument or security in question. What is considered narrow for one security may not be for another. What is considered narrow for one security may even change within the scope of the same security depending on the timeframe. In order to accurately gauge the significance of a narrowing of the bands, a technical analyst 什麼是布林通道(Bollinger Band) will need to research past BBW fluctuations and price performance to increase 什麼是布林通道(Bollinger Band) trading accuracy.
What to look for
One of the most well-known theories in regards to Bollinger Bands is that volatility typically fluctuates between periods of expansion (Bands Widening) and contraction (Bands Narrowing). With this in mind, the major trading signal generated by Bollinger Bands Width is known as The Squeeze.
The Squeeze setup is very straightforward and 什麼是布林通道(Bollinger Band) consists of two steps:
- There is a period of low volatility. The means that the bands are narrow and price is moving relatively sideways.
- The low volatility period is followed by a surge in volatility and price breaks through the Upper Band or falls through the Lower Band signifying a change in the sideways movement and the beginning of a new directional trend.
In a Bullish BBW Squeeze
- BBW drops. (In the example below, the threshold is 6% however this changes from security to security and timeframe to timeframe)什麼是布林通道(Bollinger Band)
- Price breaks through the Upper Band which starts a new upward trend. Volatility also increases.
In a Bearish BBW Squeeze
- BBW drops. (In the example below, the threshold is 9% however this changes from security to security and timeframe to timeframe).
- Price falls below the Lower Band which starts a new downward trend. Volatility also 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) increases.
Bollinger Bands Width (BBW) be quite a useful technical analysis tool for identifying "The Squeeze" which can result in some nice buying 什麼是布林通道(Bollinger Band) or selling signals. Of course the trader should always use caution. Sometimes 什麼是布林通道(Bollinger Band) the breakout after a Squeeze setup has an immediate pullback and the rally never happens. It takes a trader's better judgment 什麼是布林通道(Bollinger Band) to really determine if the breakout is a strong, legitimate one. That being said, when a strong uptrend or downtrend after a Squeeze 什麼是布林通道(Bollinger Band) does occur it provides a great opportunity for the prepared analyst or 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) trader.
The time period to be used in calculating the SMA 什麼是布林通道(Bollinger Band) which creates the base for the Upper and Lower Bands. 20 days is the default.
Determines what data from each bar will be used in calculations. Close is the default.
The number of Standard Deviations away from the SMA that the Upper and Lower Bands should be. 2 is the default.
Bollinger Bands Width
Can toggle the visibility of Bollinger Bands Width as well as the visibility of a price line showing the actual current value of the Bollinger Bands Width. Can also select the BBW Line's color, line thickness and visual type (Line is the default).
Sets the number of decimal places to be left on the indicator's value before rounding up. The higher this number, the more decimal points will be on the indicator's value.
Bollinger Band ® Width
The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band. This technical indicator provides an easy way to 什麼是布林通道(Bollinger Band) visualize consolidation before price movements (low bandwidth values) or periods of 什麼是布林通道(Bollinger Band) higher volatility (high bandwidth values). The Bollinger Band Width uses the same two parameters as the Bollinger Bands: a simple moving- average period (for the middle band) and the number of standard deviations by which the upper and lower bands should be offset from the middle 什麼是布林通道(Bollinger Band) band.
How this indicator works
- During a period of rising price 什麼是布林通道(Bollinger Band) volatility, the distance between the two bands will widen and Bollinger 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) Band Width will increase. Conversely, during a period of low market 什麼是布林通道(Bollinger Band) volatility, the distance between the two bands will contract and Bollinger Band Width will decrease. There is a tendency for bands to alternate 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) between expansion and contraction.
- When the bands are relatively far apart, that is often a sign that the current trend may be ending. When the distance between the two bands is relatively narrow that is often a sign that a market or security may be 什麼是布林通道(Bollinger Band) 什麼是布林通道(Bollinger Band) about to initiate a pronounced move in either direction.
Band Width 什麼是布林通道(Bollinger Band) = (Upper Bollinger Band - Lower Bollinger Band) / Middle Bollinger Band
Bollinger Bands are envelopes plotted at a standard deviation level above and below a simple moving average of the price.
Technical analysis focuses 什麼是布林通道(Bollinger Band) on market action — specifically, volume and price. Technical analysis is only one approach to analyzing stocks. When considering which stocks to buy or sell, you should use the approach that you're most comfortable with. As with all your investments, you must make your own determination as to whether an investment in any particular security or securities is right for you based on your investment objectives, risk tolerance, and financial situation. Past performance is no guarantee of future results.