RSI Law Script

← All 56 scripts

  • Reversal
  • Own panel
  • Beginner

Marks the candle on which a short RSI(5) closes back across the 30 or 70 line after an excursion into the extreme zone. This is the RSI Law rule from the related article, shown as completed-candle markers.

  • File iqow-rsi-law.lua
  • Version 1.0.0
  • Size 119 lines · 4 KB
  • Timeframes 5-minute candles (1-minute to 15-minute also usable)
  • License MIT
RSI Law 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

RSI(5) was at or below 30 on the previous candle and closes above 30.

LOWER marker

RSI(5) was at or above 70 on the previous candle and closes below 70.

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 panel shows RSI(5) with lines at 30, 50 and 70. A green HIGHER triangle at the bottom marks a close with RSI back above 30; a red LOWER triangle at the top marks a close with RSI back below 70.

Indicators used

  • RSI (5, 30/70)

Same view with built-in indicators: Add the Relative Strength Index with period 5 and levels 30, 50 and 70.

Default settings

RSI period5
Oversold level30
Overbought level70

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

Key points

  1. RSI Law uses a very short RSI, period 5, on the 5-minute chart.
  2. First the market must be stretched: RSI below 30 for oversold, above 70 for overbought.
  3. We do not act inside the zone. We wait for a candle to close with RSI back across the line.
  4. Back above 30 is marked HIGHER, back below 70 is marked LOWER.
  5. The marker is confirmed on a completed candle, so it will not flicker while the candle forms.
  6. Because RSI(5) is fast, consider adding a slower trend filter and test on a Practice balance.

Limitations. RSI(5) is very sensitive and in a strong trend it can leave the zone and return several times, so the article suggests a slower filter such as a long moving average. The script marks only the RSI event; it does not include the article's optional extra confirmation. The catalog's divergence idea was not used because the article describes a plain level cross. 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: 864f6cf0f3d244f6627bf6a4926352cdc56893c7986232118e653c7a70dac9d2

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW RSI Law v1.0.0
--
-- RSI Law uses a short RSI (period 5) on the 5-minute chart, as described in
-- the IQOptionWiki article. The setup is the RSI leaving its extreme zone:
-- price was oversold or overbought, and the candle closes with RSI back across
-- the 30 or 70 line. Because RSI(5) is very sensitive, the line crosses often.
--
-- HIGHER: RSI(5) was at or below 30 and closes back above 30.
-- LOWER:  RSI(5) was at or above 70 and closes back below 70.
--
-- 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 Law",
    short_name = "IQOW RSI Law",
    overlay = false
}

input_group {
    "1. RSI",
    rsi_period = input (5, "RSI period", input.integer, 2, 100),
    oversold_level = input (30, "Oversold level", input.double, 5, 45, 1, false),
    overbought_level = input (70, "Overbought level", input.double, 55, 95, 1, false)
}

input_group {
    "Display and advice",
    lines_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",
    rsi_color = input { default = "#56CEFF", type = input.color },
    level_color = input { default = rgba(255, 255, 255, 0.30), 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 }
}

rsi_value = rsi (close, rsi_period)

local rsi_now = get_value (rsi_value, nil)
local rsi_before = get_value (rsi_value [1], nil)

local levels_are_valid = oversold_level < 50 and overbought_level > 50
local data_is_ready = levels_are_valid and rsi_now ~= nil and rsi_before ~= nil

-- Event: RSI crosses back across its level on this candle.
local rsi_recovers = data_is_ready and rsi_before <= oversold_level and rsi_now > oversold_level
local rsi_fades = data_is_ready and rsi_before >= overbought_level and rsi_now < overbought_level

higher_setup = conditional (rsi_recovers)
lower_setup = conditional (rsi_fades)

-- 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_area (overbought_level, oversold_level, "Neutral zone", rgba (255, 255, 255, 0.04))
    hline (overbought_level, "Overbought", level_color, 1)
    hline (50, "Middle", rgba (255, 255, 255, 0.15), 1)
    hline (oversold_level, "Oversold", level_color, 1)
    plot (rsi_value, "RSI", rsi_color, line_width)
end

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

    plot_shape (
        confirmed_lower,
        "RSI Law LOWER",
        shape_style.triangledown,
        shape_size.small,
        lower_color,
        shape_location.top,
        -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

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)

  • Reversal
  • Own panel
  • Intermediate

KDJ Cross

Marks K/D crosses that happen while the faster J line is already stretched below 20 or above 80. J reaches the extremes first, so the cross after it is used as the timing event.

Indicators: KDJ (9, 3, 3)

  • Reversal
  • On price
  • Beginner

Keltner Re-entry

Marks the candle that closes back inside the Keltner Channel after the previous candle closed outside it. The channel width follows volatility, so a close outside it shows an unusually stretched move.

Indicators: Keltner Channel (EMA 20, 2 x ATR)

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.