Harami RSI Script

← All 56 scripts

  • Reversal
  • On price
  • Beginner

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.

  • File iqow-harami-rsi.lua
  • Version 1.0.0
  • Size 142 lines · 5 KB
  • Timeframes 5-minute to 15-minute candles
  • License MIT
Harami RSI 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 full bearish candle followed by a bullish candle with a body at most 50% of the first body and fully inside it, with RSI(14) below 40.

LOWER marker

A full bullish candle followed by a bearish candle with a body at most 50% of the first body and fully inside it, with RSI(14) above 60.

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

There are no lines on the chart; read the candles. A green HIGHER triangle marks the second candle of a bullish harami and a red LOWER triangle the second candle of a bearish harami. RSI thresholds are inputs inside the script.

Indicators used

  • Harami candle pair
  • RSI (14, 40/60)

Same view with built-in indicators: Add RSI (14) with levels 40 and 60 and spot the harami pair by eye.

Default settings

First candle minimum body share of range0.5
Second candle maximum body share of first body0.5
RSI period14
Bullish RSI level40
Bearish RSI level60

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

Key points

  1. A harami is two candles: a large candle and a small opposite-colour candle inside its body.
  2. The small candle shows the previous move slowing down.
  3. A bullish harami needs RSI below 40, a bearish harami needs RSI above 60.
  4. This differs from an inside bar, which compares highs and lows rather than bodies.
  5. Markers confirm on a completed candle.
  6. Practise on the Practice balance and look at the trend around each pattern.

Limitations. The article does not give exact size or RSI rules, so the 50% body limits and the 40/60 RSI levels are this script's definition of the pattern. A harami is only a pause and the move may continue in the previous direction. 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: 4345fc401d8e0ddcc44dc57b3a3b1c3f2c967d9369184fecdc05dbd404c11a50

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Harami RSI v1.0.0
--
-- A harami is a two-candle pattern: a full candle followed by a small
-- opposite-colour candle whose body sits inside the first candle's body.
-- RSI checks that the pattern appears after a push into an oversold or
-- overbought area.
--
-- HIGHER: candle 1 is a full bearish candle, candle 2 (this candle) is
--         bullish with a body at most 50% of candle 1's body and fully
--         inside it, and RSI(14) is below 40.
-- LOWER:  mirror image, with RSI(14) above 60.
--
-- 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 Harami RSI",
    short_name = "IQOW HARAMI",
    overlay = true
}

input_group {
    "1. Candle geometry",
    first_body_ratio = input (0.5, "First candle: minimum body share of range", input.double, 0.1, 0.95, 0.05, false),
    max_body_ratio = input (0.5, "Second candle: maximum body share of first body", input.double, 0.05, 0.95, 0.05, false)
}

input_group {
    "2. RSI",
    rsi_period = input (14, "RSI period", input.integer, 2, 100),
    oversold_level = input (40, "Bullish harami: RSI below", input.double, 5, 50, 1, false),
    overbought_level = input (60, "Bearish harami: RSI above", input.double, 50, 95, 1, false)
}

input_group {
    "Display and advice",
    signals_visible = input { default = true, type = input.plot_visibility },
    advice_enabled = input { default = false, name = "Enable platform advice", type = input.boolean }
}

input_group {
    "Colors",
    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)

-- Candle 1 is the previous bar, candle 2 is this bar.
local open_1 = get_value (open [1], nil)
local close_1 = get_value (close [1], nil)
local high_1 = get_value (high [1], nil)
local low_1 = get_value (low [1], nil)
local open_2 = get_value (open, nil)
local close_2 = get_value (close, nil)
local rsi_now = get_value (rsi_value, nil)

local levels_are_valid = oversold_level < overbought_level

local data_is_ready =
    levels_are_valid and
    open_1 ~= nil and close_1 ~= nil and high_1 ~= nil and low_1 ~= nil and
    open_2 ~= nil and close_2 ~= nil and
    rsi_now ~= nil

local body_1 = data_is_ready and math.abs (close_1 - open_1) or 0
local range_1 = data_is_ready and (high_1 - low_1) or 0
local body_2 = data_is_ready and math.abs (close_2 - open_2) or 0
local first_is_full = range_1 > 0 and body_1 >= first_body_ratio * range_1
local second_is_small = body_1 > 0 and body_2 > 0 and body_2 <= max_body_ratio * body_1

-- Bullish harami: bearish candle 1, bullish candle 2 with both open and
-- close inside candle 1's body (between its close and open).
local bullish_harami =
    data_is_ready and first_is_full and second_is_small and
    close_1 < open_1 and close_2 > open_2 and
    open_2 >= close_1 and close_2 <= open_1 and
    rsi_now < oversold_level

local bearish_harami =
    data_is_ready and first_is_full and second_is_small and
    close_1 > open_1 and close_2 < open_2 and
    open_2 <= close_1 and close_2 >= open_1 and
    rsi_now > overbought_level

higher_setup = conditional (bullish_harami)
lower_setup = conditional (bearish_harami)

-- 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 signals_visible then
    plot_shape (
        confirmed_higher,
        "Harami HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "Harami 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

Three Oscillators

Counts how many of three oscillators have just crossed back out of their extreme zone and marks the candle where at least two agree. It follows the article's trio setup, where all three is strongest and two of three is enough.

Indicators: RSI (14, 30/70) · CCI (20, +/-100) · Williams %R (14, -80/-20)

  • Reversal
  • On price
  • Beginner

Bollinger RSI Reversal

Marks the first candle that closes back inside the Bollinger Bands after a close outside a band with RSI in its oversold or overbought zone. The bands show how stretched price is and RSI adds a second view of the same stretch.

Indicators: Bollinger Bands (20, 2) · RSI (14, 30/70)

  • Reversal
  • Own panel
  • Beginner

DeMarker 30 70 Cross

Marks the candle where DeMarker closes back out of its oversold or overbought zone. The 30 and 70 levels are the ones used in the related guide.

Indicators: DeMarker (14, levels 30/70)

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.