iqow-envelopes-rsi.lua 6 KB · Free, MIT license
For the IQ Option web traderoom. Quadcode does not draw HIGHER and LOWER markers on mobile.
Add it to IQ Option in 3 steps
- Get the file. Press Get the script. Your browser saves a .lua file.
- Import it in IQ Option. Open the web traderoom on the Practice balance. Click the wave icon at the bottom left of the chart, open the Scripts tab, press Import script and pick the file.
- Add it to the chart. The code opens in an editor. Click the plus button under it (Add to chart). Save is only needed after you edit the code.
Full illustrated guide, with screenshots →
Risk. Trading can lose money. A marker is a chart observation, not a prediction, and this script is checked on test data, not proven in live trading. Try it on the Practice balance first.
- 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.
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 period | 20 |
|---|---|
| Deviation (IQ Option units, 1 = 0.1%) | 1 |
| RSI period | 14 |
| RSI level for HIGHER | 35 |
| RSI level for LOWER | 65 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- Envelopes are a moving average with two lines parallel to it, a fixed percentage above and below.
- On IQ Option the deviation is entered in tenths of a percent, so 1 means 0.1 percent.
- The article's bounce method says to watch price touching an outer line and coming back.
- We add RSI: below 35 for a lower-line bounce, above 65 for an upper-line bounce.
- The candle must close back inside the envelope, so a break through the line is not marked.
- 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.
Complete source code
The download and this preview resolve to the same reviewed file. SHA-256: 3c6ad37d98b160161b38b67515ed9c8d06c8124e6a6c09a7ce27dfffab60ec33
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Envelopes RSI v1.0.1
--
-- 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.
--
-- RSI follows IQ Option's built-in RSI: closing prices, with the average gain
-- and the average loss smoothed by an exponential average (alpha 2 / (period +
-- 1)). Version 1.0.1 (9 October 2026) changed this from Wilder smoothing; the
-- inputs, periods and levels are unchanged.
--
-- 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 as IQ Option's built-in RSI draws it: the average gain and the average
-- loss are exponential averages (alpha = 2 / (period + 1)), not Wilder's
-- smoothing (alpha = 1 / period). It stays empty until both averages exist and
-- is 50 when price did not move at all.
rsi_change = close - close [1]
rsi_gain = ema (max (rsi_change, 0), rsi_period)
rsi_loss = ema (max (-rsi_change, 0), rsi_period)
rsi_total = rsi_gain + rsi_loss
rsi_value = iff (rsi_total > 0, 100 * rsi_gain / rsi_total, rsi_total + 50)
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
- 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
- Own panel
- Intermediate
Fisher Transform Reversal
Marks a Fisher Transform cross of its trigger line while the indicator is in an extreme zone. This is the extreme-then-cross confirmation the related article describes.
Indicators: Ehlers Fisher Transform (10)
- Reversal
- On price
- Beginner
Harami RSI
Marks bullish and bearish harami candle pairs when RSI is in a low or high zone. RSI helps check that the pair follows a push in the opposite direction.
Indicators: Harami candle pair · RSI (14, 40/60)
Download all 74 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.