Bollinger Bands
Pine Script indicator by Chart GT · Published
Simple moving average with bands at a multiple of the standard deviation.
Tags: volatility, bands, mean-reversion
Source code
//@version=6
// @name Bollinger Bands
// @description Simple moving average with bands at a multiple of the standard deviation.
// @tags volatility,bands,mean-reversion
indicator("Bollinger Bands", overlay=true)
length = input.int(20, "Length", minval=1)
mult = input.float(2.0, "StdDev multiplier", minval=0.1, step=0.1)
[basis, upper, lower] = ta.bb(close, length, mult)
plot(basis, "Basis", color=color.orange)
p1 = plot(upper, "Upper", color=color.blue)
p2 = plot(lower, "Lower", color=color.blue)
fill(p1, p2, color=color.new(color.blue, 90), title="Background")
alertcondition(ta.crossover(close, upper), "Close above upper band", "Close crossed above the upper Bollinger Band")
alertcondition(ta.crossunder(close, lower), "Close below lower band", "Close crossed below the lower Bollinger Band")
License: MPL-2.0
Open the chart to add it, or browse more community scripts.