Bollinger Bands Strategy Optimization for TradingView

Optimize Bollinger Bands strategy parameters on TradingView with Pineify grid search. Test MA period, standard deviation, and entry threshold across thousands of combinations.

Add to Chrome Free

Building a Bollinger Bands Strategy

Bollinger Bands consist of a middle line (simple moving average) and two outer bands set at a specified number of standard deviations above and below the middle line. The bands widen during volatile periods and contract during quiet periods. A classic strategy enters long when price touches or breaks below the lower band and exits when it touches the upper band, or the reverse for short trades.

The parameters that control Bollinger Bands performance are: the moving average period (how many bars the middle line uses), the standard deviation multiplier (how wide the bands are), and the entry threshold (how far beyond the band price must go before you enter). You can also decide whether to exit on band touch or wait for a middle band cross. Each parameter interacts with the others in ways that are hard to predict without grid search.

Optimizable Parameters

ParameterDescriptionTypical Range
MA PeriodNumber of bars for the middle line moving average10 - 40 (step 2)
Standard DeviationMultiplier for upper and lower band width1.5 - 3.5 (step 0.5)
Entry Threshold %Percentage beyond the band that triggers entry0.5 - 3 (step 0.25)
Exit Band TouchExit when price touches the opposite band (boolean)true / false

Real Optimization Run

I ran a grid search on Bollinger Bands with MA period 10-40 (step 2), standard deviation 1.5-3.0 (step 0.5), entry threshold 0.5-2.0 (step 0.25) across EURUSD daily. That is 16 x 4 x 7 = 448 combinations. The optimization took about 7 minutes. The best setup used MA period 20, standard deviation 2.0, entry threshold 1.25% with a profit factor of 1.8 over 5 years. I was surprised that widening the bands to 2.5 actually hurt performance despite reducing false signals. Not sure this holds on other pairs though. I also tried the Exit Band Touch option and found that exiting on middle band cross worked better than exiting on the opposite band touch for this particular asset.

Frequently Asked Questions

Related Strategy Optimizations

Start Optimizing Your Bollinger Bands Strategy

Download Pineify Supercharged for free and run your first grid search optimization in minutes.

Add to Chrome Free