RSI EMA200 Engulfing Script

← All 56 scripts

  • 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.

  • File iqow-rsi-ema200-engulfing.lua
  • Version 1.0.0
  • Size 153 lines · 5 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
RSI EMA200 Engulfing 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 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 period200
RSI period14
RSI midline50

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

Key points

  1. This setup joins three things: the EMA 200, the RSI 50 line and an engulfing candle.
  2. The EMA 200 shows the long-term side. Price above it leans up, below it leans down.
  3. RSI above 50 means recent gains are stronger than recent losses; below 50 the opposite.
  4. A bullish candle that fully engulfs the previous bearish body, above the EMA with RSI above 50, is marked HIGHER.
  5. The bearish version below the EMA with RSI under 50 is marked LOWER.
  6. 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.

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: db2cc1860420cb3b9d0aa656d542b6ec7c9c64e449521fdb8979bf15f57b8c44

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW RSI EMA200 Engulfing v1.0.0
--
-- 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.
--
-- 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_value = rsi (close, rsi_period)

-- 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 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.