Bollinger RSI Reversal Script

← All 56 scripts

  • Reversal
  • On price
  • Beginner

Marks the first candle that closes back inside the Bollinger Bands after a close outside a band with RSI in its oversold or overbought zone. The bands show how stretched price is and RSI adds a second view of the same stretch.

  • File iqow-bollinger-rsi-reversal.lua
  • Version 1.0.0
  • Size 157 lines · 6 KB
  • Timeframes 5-minute candles or longer
  • License MIT
Bollinger RSI Reversal 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

The previous candle closed below the lower Bollinger Band (20, 2) with RSI(14) below 30, and the current candle closes back inside the bands as a bullish candle.

LOWER marker

The previous candle closed above the upper Bollinger Band with RSI(14) above 70, and the current candle closes back inside the bands as a bearish candle.

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 Bollinger Bands with the average in the middle. A green HIGHER triangle under a candle means price closed below the lower band with RSI under 30 and has now closed back inside as a bullish candle; a red LOWER triangle above a candle is the mirror case at the upper band.

Indicators used

  • Bollinger Bands (20, 2)
  • RSI (14, 30/70)

Same view with built-in indicators: Add IQ Option's Bollinger Bands (20, 2) and Relative Strength Index (14, levels 70/30).

Default settings

Bollinger period20
Bollinger deviation2
RSI period14
RSI oversold30
RSI overbought70

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

Key points

  1. Bollinger Bands show an average with a band two standard deviations above and below it.
  2. A close outside a band means price is stretched, and RSI below 30 or above 70 confirms the stretch.
  3. We do not act on the stretch itself; we wait for the next candle to close back inside the bands.
  4. For HIGHER that candle must also be bullish, for LOWER it must be bearish.
  5. The marker is confirmed on a completed candle, so it does not repaint.
  6. Practise on a Practice balance and note how it behaves when price trends along a band.

Limitations. The article describes a narrowing-band and RSI-trend idea without exact numeric levels, so this script uses a standard stretch-and-return rule with RSI 30/70. In a strong trend price can keep closing outside the bands and a return inside can fail. 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: 41235db93164bc1106d998aa31f0935be0015a4bdd96d3a263b20720c73f3a48

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Bollinger RSI Reversal v1.0.0
--
-- Combines Bollinger Bands (20, 2) with RSI (14). A close outside a band shows
-- price stretched away from its average, RSI in its extreme zone shows momentum
-- is stretched too, and a candle that closes back inside the bands in the
-- opposite colour shows the first reaction.
--
-- HIGHER: the previous candle closed below the lower band while RSI was below
--         30, and this candle closes back inside the bands as a bullish candle.
-- LOWER:  the previous candle closed above the upper band while RSI was above
--         70, and this candle closes back inside the bands as a bearish candle.
--
-- 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 Bollinger RSI Reversal",
    short_name = "IQOW BB RSI",
    overlay = true
}

input_group {
    "1. Bollinger Bands",
    bb_period = input (20, "Period", input.integer, 2, 200),
    bb_deviation = input (2, "Deviation", input.double, 0.5, 5, 0.1)
}

input_group {
    "2. RSI",
    rsi_period = input (14, "RSI period", input.integer, 2, 100),
    oversold_level = input (30, "Oversold level", input.double, 5, 45, 1, false),
    overbought_level = input (70, "Overbought level", input.double, 55, 95, 1, false)
}

input_group {
    "Display and advice",
    bands_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 },
    middle_color = input { default = rgba(255, 255, 255, 0.35), type = input.color },
    band_fill_color = input { default = rgba(86, 206, 255, 0.06), type = input.color },
    band_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 basis with sample standard deviation, as in the
-- official indicator.
basis_line = sma (close, bb_period)
band_offset = stdev (close, bb_period) * bb_deviation
upper_band = basis_line + band_offset
lower_band = basis_line - band_offset

rsi_value = rsi (close, rsi_period)

local upper_now = get_value (upper_band, nil)
local lower_now = get_value (lower_band, nil)
local upper_previous = get_value (upper_band [1], nil)
local lower_previous = get_value (lower_band [1], nil)
local rsi_previous = get_value (rsi_value [1], nil)
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local open_now = get_value (open, nil)

local levels_are_valid = oversold_level < 50 and overbought_level > 50

local data_is_ready =
    levels_are_valid and
    upper_now ~= nil and
    lower_now ~= nil and
    upper_previous ~= nil and
    lower_previous ~= nil and
    rsi_previous ~= nil and
    close_now ~= nil and
    close_previous ~= nil and
    open_now ~= nil

-- Previous candle closed outside a band with RSI in its extreme zone.
local stretched_down = data_is_ready and close_previous < lower_previous and rsi_previous < oversold_level
local stretched_up = data_is_ready and close_previous > upper_previous and rsi_previous > overbought_level

-- Event: this candle closes back inside the bands in the opposite colour.
local closes_inside = data_is_ready and close_now >= lower_now and close_now <= upper_now

higher_setup = conditional (stretched_down and closes_inside and close_now > open_now)
lower_setup = conditional (stretched_up and closes_inside and close_now < open_now)

-- 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 bands_visible then
    fill (upper_band, lower_band, "Bollinger area", band_fill_color)
    plot (upper_band, "Upper band", band_color, band_width)
    plot (lower_band, "Lower band", band_color, band_width)
end

if middle_visible then
    plot (basis_line, "Bollinger middle", middle_color, 1)
end

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

    plot_shape (
        confirmed_lower,
        "BB RSI 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 reversal scripts

  • Reversal
  • On price
  • Beginner

Donchian RSI Reversal

Marks the moment RSI leaves its oversold or overbought zone after price touched the matching Donchian band in the same excursion. The channel shows where price is stretched; RSI shows when momentum starts to turn.

Indicators: Donchian Channel (20) · RSI (14, 30/70)

  • Reversal
  • Own panel
  • Intermediate

Double Stochastic

Marks the candle where a slow Stochastic confirms a reversal cross that the fast Stochastic already showed in the same oversold or overbought zone. Using two settings asks the same question on two time scales before a marker appears.

Indicators: Stochastic fast (8, 3, 5) · Stochastic slow (17, 3, 7)

  • Reversal
  • On price
  • Beginner

Envelopes RSI

Marks a bounce from the Envelope lines: a candle reaches the outer line, closes back inside, and RSI confirms that price was stretched. It follows the 'bounce from the sides' method in the related article.

Indicators: Moving Average Envelopes (SMA 20, deviation 1) · RSI (14, 35/65)

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.