BB1 Bollinger Script

← All 56 scripts

  • Breakout
  • On price
  • Beginner

Marks the first candle that closes outside a narrow Bollinger Band (deviation 1) after two candles closed inside it. It follows the BB1 rule from the related article, where the move out of the band is read in the direction of the break.

  • File iqow-bb1-bollinger.lua
  • Version 1.0.0
  • Size 140 lines · 5 KB
  • Timeframes 5-minute candles
  • License MIT
BB1 Bollinger drawn on synthetic candles
How the script draws, shown on synthetic candles generated for testing. It is an illustration of the markers and lines, not real market data or a result.

The rules

HIGHER marker

A candle closes above the upper Bollinger Band (20, deviation 1) after the previous two candles closed at or below it.

LOWER marker

A candle closes below the lower Bollinger Band (20, deviation 1) after the previous two candles closed at or above it.

A marker appears after the next candle opens and is drawn on the candle that completed the setup. It is a chart observation, not an instruction to trade.

How to read it

The blue lines are the upper and lower bands one standard deviation from the 20-candle average, with a faint middle line. A green HIGHER triangle under a candle marks a fresh close above the upper band; a red LOWER triangle above a candle marks a fresh close below the lower band.

Indicators used

  • Bollinger Bands (20, deviation 1)

Same view with built-in indicators: Add Bollinger Bands with period 20 and deviation 1 on 5-minute Japanese candles.

Default settings

Bollinger period20
Deviation1
Candles inside before the close2

Every value is an input in the script settings. Platform advice is off by default.

Key points

  1. BB1 is Bollinger Bands with the deviation set to 1 instead of 2.
  2. The bands are narrower, so price closes outside them more often.
  3. The rule needs a fresh break: the two candles before must have closed inside the band.
  4. A close above the upper band is marked HIGHER, a close below the lower band is marked LOWER.
  5. The article uses this on 5-minute charts and favours trending markets.
  6. Test it on a Practice balance and compare trending and sideways sessions.

Limitations. The article presents BB1 as a trending-market tool, and it can give weak results in flat markets where price slips outside the narrow band and returns. Deviation 1 is tight, so a close outside the band is a common event rather than an extreme one. The marker follows the break; it is the opposite of a band-reversal reading. Test on the Practice balance before risking real funds.

Learn the strategy: read the full guide on IQOptionWiki →

Install it in four steps

  1. Download and inspectDownload one .lua file and open it in a plain-text editor if you want to read it first. If you downloaded the ZIP, extract it.
  2. Open Chart Analysis → ScriptsIn the IQ Option traderoom, choose the Practice balance, open the chart analysis panel, select Scripts and choose Import script.
  3. Save and add to chartSelect the downloaded file, review the imported code, choose Save, then use the + control to add it to the chart.
  4. Change one input at a timeConfirm the default view first. Then adjust periods, levels or colours one setting at a time and note what changes.

Complete source code

The download and this preview resolve to the same reviewed file. SHA-256: 9339d745e157d9a183a94c38aa1b001e1e352e0b8583031769a2efed16d152af

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW BB1 Bollinger v1.0.0
--
-- BB1 is a Bollinger Bands setup with a deviation of 1 instead of the usual 2,
-- as described in the IQOptionWiki article. Price closing outside the narrow
-- band after sitting inside it marks a push away from the average.
--
-- HIGHER: this candle closes above the upper band after the previous two
--         candles closed at or below the upper band.
-- LOWER:  this candle closes below the lower band after the previous two
--         candles closed at or above the lower band.
--
-- Markers use the previous completed candle: they appear after the next candle
-- opens and are shifted back one bar onto the candle that qualified.
-- Educational chart tool only. It does not place trades, choose an expiry,
-- predict outcomes, or guarantee results. Test on a Practice balance first.

instrument {
    name = "IQOW BB1 Bollinger",
    short_name = "IQOW BB1",
    overlay = true
}

input_group {
    "1. Bollinger Bands",
    bb_period = input (20, "Period", input.integer, 2, 200),
    bb_deviation = input (1, "Deviation", input.double, 0.1, 5, 0.1, false),
    quiet_candles = input (2, "Candles inside before the close", input.integer, 1, 5)
}

input_group {
    "Display and advice",
    lines_visible = input { default = true, type = input.plot_visibility },
    middle_visible = input { default = true, type = input.plot_visibility },
    signals_visible = input { default = true, type = input.plot_visibility },
    advice_enabled = input { default = false, name = "Enable platform advice", type = input.boolean }
}

input_group {
    "Colors",
    band_color = input { default = "#56CEFF", type = input.color },
    band_fill_color = input { default = rgba(86, 206, 255, 0.06), type = input.color },
    middle_color = input { default = rgba(255, 255, 255, 0.35), type = input.color },
    line_width = input { default = 1, type = input.line_width },
    higher_color = input { default = "#25E154", type = input.color },
    lower_color = input { default = "#FF6C58", type = input.color },
    signal_text_color = input { default = "#FFFFFF", type = input.color }
}

-- Bollinger Bands: SMA of close plus and minus deviation times stdev.
middle_band = sma (close, bb_period)
band_offset = stdev (close, bb_period) * bb_deviation
upper_band = middle_band + band_offset
lower_band = middle_band - band_offset

local close_now = get_value (close, nil)
local upper_now = get_value (upper_band, nil)
local lower_now = get_value (lower_band, nil)

local data_is_ready = close_now ~= nil and upper_now ~= nil and lower_now ~= nil

-- The earlier candles must have closed on the inner side of the band.
local was_inside_upper = data_is_ready
local was_inside_lower = data_is_ready
for back = 1, quiet_candles do
    local past_close = get_value (close [back], nil)
    local past_upper = get_value (upper_band [back], nil)
    local past_lower = get_value (lower_band [back], nil)
    if past_close == nil or past_upper == nil or past_lower == nil then
        was_inside_upper = false
        was_inside_lower = false
    else
        was_inside_upper = was_inside_upper and past_close <= past_upper
        was_inside_lower = was_inside_lower and past_close >= past_lower
    end
end

higher_setup = conditional (data_is_ready and close_now > upper_now and was_inside_upper)
lower_setup = conditional (data_is_ready and close_now < lower_now and was_inside_lower)

-- Confirm only a new setup on the previous completed candle.
confirmed_higher = conditional (
    get_value (higher_setup [1], false) and
    not get_value (higher_setup [2], false)
)

confirmed_lower = conditional (
    get_value (lower_setup [1], false) and
    not get_value (lower_setup [2], false)
)

if lines_visible then
    fill (upper_band, lower_band, "Bollinger area", band_fill_color)
    plot (upper_band, "Upper band", band_color, line_width)
    plot (lower_band, "Lower band", band_color, line_width)
end

if middle_visible then
    plot (middle_band, "Middle band (SMA)", middle_color, 1)
end

if signals_visible then
    plot_shape (
        confirmed_higher,
        "BB1 HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "BB1 LOWER",
        shape_style.triangledown,
        shape_size.small,
        lower_color,
        shape_location.abovebar,
        -1,
        "LOWER",
        signal_text_color
    )
end

-- QCS advice is a platform notification state only; it does not place trades.
if advice_enabled and
    get_value (confirmed_higher, false) and
    not get_value (confirmed_lower, false) then
    advise (advice.buy)
elseif advice_enabled and
    get_value (confirmed_lower, false) and
    not get_value (confirmed_higher, false) then
    advise (advice.sell)
else
    advise (advice.neutral)
end

More breakout scripts

  • Breakout
  • On price
  • Intermediate

Donchian Turtle Breakout

Marks a close beyond the previous 20-candle high or low when ATR is above its 50-period average. It is a simplified channel breakout in the spirit of the Turtle rules, with an ATR filter to ask for expanding volatility.

Indicators: Donchian breakout (20) · ATR (14) · SMA of ATR (50)

  • Breakout
  • On price
  • Intermediate

Fractal Chaos Bands Break

Marks a close through the Fractal Chaos Bands: the upper band is the last confirmed fractal high and the lower band the last confirmed fractal low.

Indicators: Fractal Chaos Bands

Download all 56 scripts as one ZIP · MIT License, provided “as is”, without warranty. IQOptionWiki is independent of the IQ Option platform operator. Nothing here is investment advice or a guarantee of results.

GENERAL RISK WARNING

The financial products offered by the company carry a high level of risk and can result in the loss of all your funds. You should never invest money that you cannot afford to lose.
Kindly note that this article does not provide any investment advice. The information presented regarding past events or potential future developments is solely an opinion and cannot be guaranteed as factual, including the provided examples. We caution readers accordingly.