How I Used Tradingview To Create And Backtest A Bollinger Band Trading Strategy
Taking advantage of the popularity of Tradingview and its powerful tools for technical analysis, we will explore Bollinger Bands and their potential for creating a trading strategy. Stay with us until the end to see how we use the tools on this platform and make the most of them.
Bollinger Bands is perhaps one of the most well-known technical indicators in technical analysis. They provide us with information about the volatility of an asset. With this tool and dedicated time to analyze the results, we can obtain a solid foundation for a trading system and conduct a backtest.
Related reading: – More Bollinger Bands trading strategies
What are Bollinger Bands?
Bollinger Bands were developed by financial analyst John Bollinger in the 1980s and are used to analyze volatility and potential trend changes in various assets.
The bands consist of a central moving average accompanied by its standard deviations projected above and below the main line.
The upper band is calculated by adding a multiple of the standard deviation to the moving average, while the lower band is calculated by subtracting a multiple of the standard deviation from the moving average.
It’s a pretty simple principle.
Are Bollinger Bands a good indicator?
As we have mentioned, Bollinger Bands help us visualize the volatility of an asset. With this, we can see how much it has moved in relation to its trading average, make estimations about an imminent reversal, or continuity in the prevailing trend.
It is one of the most robust indicators for these purposes and surprisingly easy to use, but let this not confuse us; its implementation in a systematic trading system to define the appropriate rules can be a time-consuming task. Also, we need to backtest to find out if it has any practical use.
What is the disadvantage of the Bollinger band?
We need to know that an indicator like Bollinger Bands alone will not give us a profitable system, which is why we need to consider some possible disadvantages when implementing it. Here are see some:
False signals: Just like with any technical indicator, Bollinger Bands can generate false signals. It is possible for the price to touch or cross a band, but instead of producing a reversal or continuation of the trend, the price may continue moving in the opposite direction to the signal. This applies to assets that tend to mean reverse.
Range-bound markets: Bollinger Bands are based on market volatility. If the market is in a range or consolidation period, with low volatility and sideways movements, Bollinger Bands may not be as effective.
Signal delays: Bollinger Bands are based on historical data and moving averages, which means there may be delays in the generated signals.
Sensitivity to time period and settings: Bollinger Bands are sensitive to the time period used for calculating the moving average and standard deviation. Changing the time period or settings can produce different results and generate contradictory signals.
How to set up Bollinger Bands in Tradingview?
The Bollinger Bands calculate the 20-period moving average in their default settings, but we can modify this to our liking from the indicator window.
The same goes for their standard deviations; we can test different values by adjusting them to the behavior of the asset we are analyzing. We can also modify the source used to calculate the average, in this case, the Close.
This is how it will look on our chart.
Bollinger Bands Breakout Trading Strategy
A Bollinger Bands breakout strategy is based on identifying and capitalizing on breakouts or breaches of the bands.
Trading Rules
THIS SECTION IS FOR MEMBERS ONLY. _________________ BECOME A MEBER TO GET ACCESS TO TRADING RULES IN ALL ARTICLES CLICK HERE TO SEE ALL 350 ARTICLES WITH TRADING RULESHow are Bollinger Bands calculated in TradingView?
Bollinger Bands are calculated based on a base moving average, to which its standard deviations are attached above and below. Let’s see how we can achieve this using Pine Script in TradingView.
We will use the built-in function ta.sma(), which takes two parameters to calculate a simple moving average: Source and Length.
So our baseline for the Bollinger Bands would be as follows:
From here on, we have the development of the standard deviations! First, we use the ta.stedv() function to which we will add a multiplier, the one with which we define the bands themselves:
If we define a parameter for the multiplier and use it along with the function to calculate the standard deviation, it is not left:
Now, the bands are simply adding or subtracting the dev value to the base moving average.
How effective are Bollinger Bands?
Bollinger Bands are an excellent indicator, but to develop a trading system, you need some assistance in defining and optimizing parameters to achieve the best performance.
We can test different time frames depending on the frequency of trades we are seeking and, above all, define the risk.
The effectiveness of Bollinger Bands is defined by our set of trading rules when developing a trading system.
By testing the H4 time frame and modifying some parameters, we achieved a considerable return by using 100% of our capital for each trade. The drawdown may be uncomfortable for many traders, but there is room for improvement in this type of strategy. However, this was just an example, so you must research properly.
Final Thoughts
Developing a strategy with Bollinger Bands on Tradingview is a straightforward process, and the platform provides us with all the tools to create a functional prototype quickly. Whether it’s a Breakout, Mean Reversion, or Squeeze strategy, Bollinger Bands provides valuable information for any analysis and can play a primary or secondary role in any trading strategy.