Envelopes RSI Script

← All 56 scripts

  • Reversal
  • On price
  • Beginner

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.

  • File iqow-envelopes-rsi.lua
  • Version 1.0.0
  • Size 146 lines · 5 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
Envelopes RSI 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 candle's low touches or pierces the lower Envelope (SMA 20, deviation 1 = 0.1%), it closes back above that line, and RSI(14) is below 35.

LOWER marker

The candle's high touches or pierces the upper Envelope, it closes back below that line, and RSI(14) is above 65.

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 Envelope and the orange line is the SMA between them. A green HIGHER triangle under a candle marks a bounce from the lower line with RSI below 35; a red LOWER triangle above a candle marks a bounce from the upper line with RSI above 65.

Indicators used

  • Moving Average Envelopes (SMA 20, deviation 1)
  • RSI (14, 35/65)

Same view with built-in indicators: Add Envelopes (SMA 20, deviation 1) on the price chart and Relative Strength Index (14) below it.

Default settings

SMA period20
Deviation (IQ Option units, 1 = 0.1%)1
RSI period14
RSI level for HIGHER35
RSI level for LOWER65

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

Key points

  1. Envelopes are a moving average with two lines parallel to it, a fixed percentage above and below.
  2. On IQ Option the deviation is entered in tenths of a percent, so 1 means 0.1 percent.
  3. The article's bounce method says to watch price touching an outer line and coming back.
  4. We add RSI: below 35 for a lower-line bounce, above 65 for an upper-line bounce.
  5. The candle must close back inside the envelope, so a break through the line is not marked.
  6. Adjust the deviation for your timeframe and test on a Practice balance.

Limitations. The article says bounces suit low-volatility markets, and breakouts through the line in fast markets are the opposite case. A fixed percentage width does not adapt to volatility, so the deviation should be tuned for each timeframe and instrument; the article's examples use SMA 9, while this script uses SMA 20. 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: b46ba693dd811b2d3aeb9f82cdeccb05581dc6cef335e73bdcd2883b6212778d

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Envelopes RSI v1.0.0
--
-- Moving Average Envelopes draw two lines a fixed percentage above and below
-- a simple moving average. The article's "bounce from the sides" idea is used:
-- price dips through an envelope line, closes back inside, and RSI agrees that
-- the move was stretched. Deviation uses IQ Option's unit: 1 = 0.1% of the average.
--
-- HIGHER: the low touches or pierces the lower envelope, the candle closes back
--         above it, and RSI(14) is below 35.
-- LOWER:  the high touches or pierces the upper envelope, the candle closes back
--         below it, and RSI(14) is above 65.
--
-- 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 Envelopes RSI",
    short_name = "IQOW ENV RSI",
    overlay = true
}

input_group {
    "1. Envelopes",
    envelope_period = input (20, "SMA period", input.integer, 2, 200),
    envelope_deviation = input (1, "Deviation (1 = 0.1%)", input.double, 0.01, 300, 0.01, false)
}

input_group {
    "2. RSI filter",
    rsi_period = input (14, "RSI period", input.integer, 2, 100),
    rsi_low_level = input (35, "RSI below this for HIGHER", input.double, 5, 50, 1, false),
    rsi_high_level = input (65, "RSI above this for LOWER", input.double, 50, 95, 1, false)
}

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",
    envelope_color = input { default = "#2384C2", type = input.color },
    envelope_fill_color = input { default = rgba(86, 206, 255, 0.10), type = input.color },
    middle_color = input { default = "#FF7700", 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 }
}

-- Envelopes as on the IQ Option chart: SMA plus and minus deviation / 1000.
middle_line = sma (close, envelope_period)
envelope_offset = envelope_deviation / 1000 * middle_line
upper_line = middle_line + envelope_offset
lower_line = middle_line - envelope_offset

rsi_value = rsi (close, rsi_period)

local high_now = get_value (high, nil)
local low_now = get_value (low, nil)
local close_now = get_value (close, nil)
local upper_now = get_value (upper_line, nil)
local lower_now = get_value (lower_line, nil)
local rsi_now = get_value (rsi_value, nil)

local levels_are_valid = rsi_low_level < 50 and rsi_high_level > 50
local data_is_ready =
    levels_are_valid and
    high_now ~= nil and low_now ~= nil and close_now ~= nil and
    upper_now ~= nil and lower_now ~= nil and rsi_now ~= nil

-- Touch the envelope, close back inside, and RSI shows the stretch.
higher_setup = conditional (
    data_is_ready and low_now <= lower_now and close_now > lower_now and rsi_now < rsi_low_level
)

lower_setup = conditional (
    data_is_ready and high_now >= upper_now and close_now < upper_now and rsi_now > rsi_high_level
)

-- 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_line, lower_line, "Envelope area", envelope_fill_color)
    plot (upper_line, "Upper envelope", envelope_color, line_width)
    plot (lower_line, "Lower envelope", envelope_color, line_width)
end

if middle_visible then
    plot (middle_line, "Envelope middle (SMA)", middle_color, 1)
end

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

    plot_shape (
        confirmed_lower,
        "ENV 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

Stochastic PSAR

Marks a Stochastic %K/%D cross that starts in the oversold or overbought zone while the Parabolic SAR dot is on the matching side of price. The Stochastic gives the timing and the SAR checks the trailing stop agrees.

Indicators: Stochastic (14, 3, 3) · Parabolic SAR (0.02, 0.2)

  • Reversal
  • Own panel
  • Intermediate

Three Oscillators

Counts how many of three oscillators have just crossed back out of their extreme zone and marks the candle where at least two agree. It follows the article's trio setup, where all three is strongest and two of three is enough.

Indicators: RSI (14, 30/70) · CCI (20, +/-100) · Williams %R (14, -80/-20)

  • Reversal
  • On price
  • Beginner

Bollinger RSI Reversal

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.

Indicators: Bollinger Bands (20, 2) · RSI (14, 30/70)

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.