iqow-rsi-ema200-engulfing.lua 5 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.
- Price action
- On price
- Intermediate
Marks an engulfing candle that agrees with the long-term EMA 200 side and the RSI 50 midline. The EMA and RSI filter out engulfing candles that go against the broader direction.
The rules
HIGHER marker
A bullish candle whose body fully engulfs the previous bearish body closes above EMA 200 while RSI(14) is above 50.
LOWER marker
A bearish candle whose body fully engulfs the previous bullish body closes below EMA 200 while RSI(14) is below 50.
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 yellow line on the price chart is EMA 200. A green HIGHER triangle under a candle marks a bullish engulfing candle that closed above the EMA with RSI above 50; a red LOWER triangle above a candle marks a bearish engulfing candle below the EMA with RSI below 50. RSI is not drawn on the price chart.
Indicators used
- EMA (200)
- RSI (14, midline 50)
- Engulfing candle
Same view with built-in indicators: Add an Exponential Moving Average with period 200 and RSI (period 14) with a single line at 50, then look for engulfing candles by eye.
Default settings
| EMA period | 200 |
|---|---|
| RSI period | 14 |
| RSI midline | 50 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- This setup joins three things: the EMA 200, the RSI 50 line and an engulfing candle.
- The EMA 200 shows the long-term side. Price above it leans up, below it leans down.
- RSI above 50 means recent gains are stronger than recent losses; below 50 the opposite.
- A bullish candle that fully engulfs the previous bearish body, above the EMA with RSI above 50, is marked HIGHER.
- The bearish version below the EMA with RSI under 50 is marked LOWER.
- The marker appears after the candle closes. Test it on the Practice balance first.
Limitations. Engulfing candles are rare, so markers are sparse, and on quiet charts they can be tiny. Price often stays close to a long EMA in sideways markets, where the side of the EMA says little. 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: 6970a74fe46ec55b192162d9feba641ad1b2ce69c8eef6ff4da8acc59fc24e75
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW RSI EMA200 Engulfing v1.0.1
--
-- Combines a candlestick pattern with two trend filters. The EMA 200 gives the
-- long-term side of the market and RSI(14) against the 50 line gives the
-- medium-term momentum side. An engulfing candle is the trigger.
--
-- 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: a bullish candle whose body engulfs the previous bearish body
-- closes above EMA 200 while RSI(14) is above 50.
-- LOWER: a bearish candle whose body engulfs the previous bullish body
-- closes below EMA 200 while RSI(14) is below 50.
--
-- 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 RSI EMA200 Engulfing",
short_name = "IQOW ENGULF",
overlay = true
}
input_group {
"1. Trend filter",
ema_period = input (200, "EMA period", input.integer, 2, 500)
}
input_group {
"2. RSI",
rsi_period = input (14, "RSI period", input.integer, 2, 100),
rsi_midline = input (50, "RSI midline", input.double, 30, 70, 1, false)
}
input_group {
"Display and advice",
ema_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",
ema_color = input { default = "#DBCF0D", type = input.color },
ema_width = input { default = 2, 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 }
}
ema_line = ema (close, ema_period)
-- 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)
-- Current-bar scalars for the Lua rule logic.
local open_now = get_value (open, nil)
local close_now = get_value (close, nil)
local open_previous = get_value (open [1], nil)
local close_previous = get_value (close [1], nil)
local ema_now = get_value (ema_line, nil)
local rsi_now = get_value (rsi_value, nil)
-- Wait until the EMA has a full period of history behind it.
local has_history = get_value (close [ema_period], nil) ~= nil
local data_is_ready =
has_history and
open_now ~= nil and
close_now ~= nil and
open_previous ~= nil and
close_previous ~= nil and
ema_now ~= nil and
rsi_now ~= nil
-- Bullish engulfing: a bearish candle followed by a bullish candle whose body
-- covers the whole previous body.
local bullish_engulfing =
data_is_ready and
close_previous < open_previous and
close_now > open_now and
open_now <= close_previous and
close_now >= open_previous
-- Bearish engulfing: a bullish candle followed by a bearish candle whose body
-- covers the whole previous body.
local bearish_engulfing =
data_is_ready and
close_previous > open_previous and
close_now < open_now and
open_now >= close_previous and
close_now <= open_previous
higher_setup = conditional (
bullish_engulfing and close_now > ema_now and rsi_now > rsi_midline
)
lower_setup = conditional (
bearish_engulfing and close_now < ema_now and rsi_now < rsi_midline
)
-- 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 ema_visible then
plot (ema_line, "EMA 200", ema_color, ema_width)
end
if signals_visible then
plot_shape (
confirmed_higher,
"ENGULF HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"ENGULF 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 price action scripts
- Price action
- On price
- Beginner
Three Candles Continuation
Marks the candle that completes three same-colour full-bodied candles with steady closes while price is on the matching side of EMA 20. An option flips the reading to the counter-trend idea described in the article.
Indicators: Three full candles · EMA (20)
- Price action
- On price
- Beginner
Inside Bar Breakout
Marks the first close beyond the mother bar after an inside bar, within 3 candles and in the direction of EMA 50. The inside bar shows a pause; the breakout shows which way it resolved.
Indicators: Inside bar pattern · EMA (50)
- Price action
- On price
- Intermediate
Pin Bar Bollinger
Marks a pin bar whose long wick reaches an outer Bollinger Band and whose body closes back inside. The band shows where price is stretched; the pin bar shows that the stretch was rejected.
Indicators: Bollinger Bands (20, 2) · Pin bar candle geometry
Download all 70 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.