0% found this document useful (0 votes)
66 views

BB Script

The document defines an indicator for a Bollinger Bands style technical analysis indicator. It allows the user to configure period length, shift value, moving average type, and visibility/colors of upper, middle, lower bands and the fill between the bands. The indicator calculates upper, middle, and lower bands based on the selected moving average type and plots the bands and fill if their visibilities are enabled.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

BB Script

The document defines an indicator for a Bollinger Bands style technical analysis indicator. It allows the user to configure period length, shift value, moving average type, and visibility/colors of upper, middle, lower bands and the fill between the bands. The indicator calculates upper, middle, and lower bands based on the selected moving average type and plots the bands and fill if their visibilities are enabled.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

instrument { name = "Canal Bordas de Bolinger", icon="indicators:ADX", overlay =

true }
period = input (5, "front.period", input.integer, 1)
shift = input (1, "front.newind.offset", input.double, 0.01, 300, 0.01)
fn = input (averages.ema, "front.newind.average", input.string_selection,
averages.titles)
input_group {
"front.top line",
upper_line_visible = input { default = true, type = input.plot_visibility },
upper_line_color = input { default = "#ff0000", type = input.color },
upper_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.middle line",
middle_line_visible = input { default = true, type = input.plot_visibility },
middle_line_color = input { default = #ffffff, type = input.color },
middle_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.bottom line",
lower_line_visible = input { default = true, type = input.plot_visibility },
lower_line_color = input { default = "#00FF00", type = input.color },
lower_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.newind.adx.fill",
fill_visible = input { default = true, type = input.plot_visibility },
fill_color = input { default = rgba(33,177,144,0.08), type = input.color },
}
local averageFunction = averages [fn]
middle = averageFunction (hlc3, period)
offset = rma(tr, period) * shift
upper = middle + offset
lower = middle - offset
if fill_visible then
fill { first = upper, second = lower, color = fill_color }
end
if upper_line_visible then
plot (upper, "Upper", upper_line_color, upper_line_width)
end
if lower_line_visible then
plot (lower, "Lower", lower_line_color, lower_line_width)
end
if middle_line_visible then
plot (middle, "Middle", middle_line_color, middle_line_width)
end

You might also like