Entrepreneur Start
← Back to Home

Bollinger Band Moving Average BBMA Indicator for TradingView

trading|15 November 2024|1 Min read

Download indicators in mql5 Markets here

MT4 BBMA MT4 MT5 BBMA MT5

BBMA TradingView

TradingView didn’t allow non paying user to publish script, therefore i publish it here:

// BBMA Indicator for TradingView (Pine Script)
//@version=5
indicator("Bollinger Band Moving Average BBMA Indicator", shorttitle="BBMA", overlay=true)

// Inputs
LWMAPeriod = input.int(10, title="LWMA Period")
BBPeriod = input.int(5, title="Bollinger Bands Period")
BBDeviations = input.float(0.5, title="Bollinger Bands Deviations")
ShowArrow = input.bool(true, title="Show Buy/Sell Arrows")

// LWMA Calculation
lwma = ta.wma(close, LWMAPeriod)

// Bollinger Bands Calculation
basis = ta.sma(lwma, BBPeriod)
upperBand = basis + BBDeviations * ta.stdev(lwma, BBPeriod)
lowerBand = basis - BBDeviations * ta.stdev(lwma, BBPeriod)

// Additional Bollinger Bands with LWMA basis
upperBand2 = lwma + BBDeviations * ta.stdev(close, BBPeriod)
lowerBand2 = lwma - BBDeviations * ta.stdev(close, BBPeriod)

// Plot LWMA and Bollinger Bands
plot(lwma, color=color.orange, linewidth=3, title="LWMA")
plot(basis, color=color.aqua, linewidth=2, title="BBLine")
plot(upperBand, color=color.aqua, linewidth=2, title="UpperLine")
plot(lowerBand, color=color.aqua, linewidth=2, title="LowerLine")
//label.new(bar_index, high, "Test")

// Conditions for Buy/Sell Arrows
buySignal = ta.crossover(lwma, upperBand)
sellSignal = ta.crossunder(lwma, lowerBand)
//plot(buySignal ? 1 : 0, color=color.green)
// Plot Arrows
plotshape(buySignal and ShowArrow, location=location.belowbar, color=color.yellow, style=shape.labelup, size=size.small, title="Buy", text="Buy")
plotshape(sellSignal and ShowArrow, location=location.abovebar, color=color.orange, style=shape.labeldown, size=size.small, title="Sell", text="Sell")

// Alerts
alertcondition(buySignal, title="Buy Alert", message="BBMA Buy Signal")
alertcondition(sellSignal, title="Sell Alert", message="BBMA Sell Signal")

Copy and past in Pine Editor and place in chart. enjoy…..