RSI Stochastic EMA200 Script

← All 56 scripts

  • Trend
  • On price
  • Intermediate

Uses the EMA 200 as a trend filter, RSI 50 as a momentum filter and a Stochastic cross out of its extreme zone as the timing. It marks the end of a pullback in the direction of the larger trend.

  • File iqow-rsi-stochastic-ema200.lua
  • Version 1.0.0
  • Size 152 lines · 5 KB
  • Timeframes Any timeframe; the article shows higher timeframes with stop and target
  • License MIT
RSI Stochastic EMA200 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 close is above EMA(200), RSI(14) is above 50, and Stochastic %K crosses above %D after %K was at or below 20 on the previous candle.

LOWER marker

The close is below EMA(200), RSI(14) is below 50, and Stochastic %K crosses below %D after %K was at or above 80 on the previous 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 yellow line is the EMA 200 trend filter. A green HIGHER triangle under a candle means price is above the EMA, RSI is above 50 and the Stochastic has just crossed up out of oversold; a red LOWER triangle above a candle is the mirror case below the EMA. RSI and the Stochastic are not drawn on the price chart.

Indicators used

  • EMA (200)
  • RSI (14)
  • Stochastic (14, 3, 3)

Same view with built-in indicators: Add IQ Option's Moving Average of type EMA (200), Relative Strength Index (14) and Stochastic (14, 3, 3, levels 80/20).

Default settings

EMA period200
RSI period14
RSI midline50
Stochastic %K14
Stochastic smoothing3
Stochastic %D3
Oversold20
Overbought80

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

Key points

  1. Step one is the trend: price above the EMA 200 means we only look for HIGHER marks.
  2. Step two is momentum: RSI should be above 50 for HIGHER and below 50 for LOWER.
  3. Step three is timing: the Stochastic %K line crosses %D after sitting in the oversold or overbought zone.
  4. This is a pullback idea: the Stochastic shows the pullback is ending while the trend filter still agrees.
  5. The article also uses RSI divergence by eye; this script uses the RSI 50 side as a simple stand-in.
  6. Marks are confirmed on a completed candle. Try it on a Practice balance.

Limitations. The article uses RSI to spot hidden divergence by eye; the script uses a simple RSI above or below 50 check instead, because divergence cannot be defined exactly in a few lines. The Stochastic is calculated from closing prices, as in IQ Option's built-in version. Marks are rare because every condition must agree. 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: 2e0e700c4f4242d1fac5b514428b73fee26a0cbb39134c0cf2983f1691779467

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW RSI Stochastic EMA200 v1.0.0
--
-- Combines three tools as in the related article: the EMA 200 as a trend
-- filter, RSI (14) for the side of 50, and the Stochastic (14, 3, 3) for the
-- entry timing. The Stochastic cross must start from the oversold or overbought
-- zone, so it marks the end of a pullback in the direction of the trend.
--
-- HIGHER: close is above EMA 200, RSI is above 50, and %K crosses above %D
--         after %K was at or below 20 on the previous candle.
-- LOWER:  close is below EMA 200, RSI is below 50, and %K crosses below %D
--         after %K was at or above 80 on the previous 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 RSI Stochastic EMA200",
    short_name = "IQOW RSI STO",
    overlay = true
}

input_group {
    "1. Trend filter and RSI",
    ema_period = input (200, "EMA period", input.integer, 10, 400),
    rsi_period = input (14, "RSI period", input.integer, 2, 100),
    rsi_midline = input (50, "RSI midline", input.double, 30, 70, 1, false)
}

input_group {
    "2. Stochastic",
    k_period = input (14, "%K period", input.integer, 2, 100),
    k_smoothing = input (3, "%K smoothing", input.integer, 1, 20),
    d_period = input (3, "%D period", input.integer, 1, 20),
    oversold_level = input (20, "Oversold level", input.double, 1, 45, 1, false),
    overbought_level = input (80, "Overbought level", input.double, 55, 99, 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 = "#FFD166", 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 }
}

trend_ema = ema (close, ema_period)
rsi_value = rsi (close, rsi_period)

-- Stochastic as in the official indicator: %K smoothed, %D = SMA of %K.
stoch_k = sma (stochastic (close, k_period), k_smoothing) * 100
stoch_d = sma (stoch_k, d_period)

local ema_now = get_value (trend_ema, nil)
local rsi_now = get_value (rsi_value, nil)
local k_now = get_value (stoch_k, nil)
local d_now = get_value (stoch_d, nil)
local k_previous = get_value (stoch_k [1], nil)
local d_previous = get_value (stoch_d [1], nil)
local close_now = get_value (close, nil)

local levels_are_valid = oversold_level < 50 and overbought_level > 50

local data_is_ready =
    levels_are_valid and
    get_value (close [ema_period], nil) ~= nil and
    ema_now ~= nil and
    rsi_now ~= nil and
    k_now ~= nil and
    d_now ~= nil and
    k_previous ~= nil and
    d_previous ~= nil and
    close_now ~= nil

-- Event: %K crosses %D on this candle, starting from the extreme zone.
local cross_up_from_oversold =
    data_is_ready and k_previous <= d_previous and k_now > d_now and k_previous <= oversold_level
local cross_down_from_overbought =
    data_is_ready and k_previous >= d_previous and k_now < d_now and k_previous >= overbought_level

higher_setup = conditional (
    cross_up_from_oversold and close_now > ema_now and rsi_now > rsi_midline
)

lower_setup = conditional (
    cross_down_from_overbought 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 (trend_ema, "EMA 200", ema_color, ema_width)
end

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

    plot_shape (
        confirmed_lower,
        "RSI STO 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 trend scripts

  • Trend
  • Own panel
  • Intermediate

Trend Intensity Index

Marks the moment the Trend Intensity Index enters its strong zone: above 80 for upward pressure or below 20 for downward pressure, with the close on the matching side of the 60-period SMA. It is a trend-strength entry marker, not a reversal marker.

Indicators: Trend Intensity Index (30, SMA 60)

  • Trend
  • On price
  • Intermediate

VHF EMA Cross

Marks EMA 9 and EMA 21 crosses only while the Vertical Horizontal Filter reports a trending market. The filter removes crosses that happen during sideways price action, where moving-average crosses tend to be unreliable.

Indicators: Vertical Horizontal Filter (28, 0.35) · EMA (9) · EMA (21)

  • Trend
  • Own panel
  • Intermediate

Vortex MACD

Marks a Vortex VI+/VI- cross when the MACD line is on the matching side of its signal line. The Vortex cross shows which direction dominates and the MACD checks that momentum agrees.

Indicators: Vortex Indicator (21) · MACD (12, 26, 9)

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.