Inside Bar Breakout Script

← All 56 scripts

  • Price action
  • On price
  • Beginner

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.

  • File iqow-inside-bar-breakout.lua
  • Version 1.0.0
  • Size 153 lines · 5 KB
  • Timeframes 1-minute to 15-minute candles
  • License MIT
Inside Bar Breakout 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

Within 3 candles after an inside bar, the first candle that closes above the mother bar's high while its close is above EMA 50 is marked HIGHER.

LOWER marker

Within 3 candles after an inside bar, the first candle that closes below the mother bar's low while its close is below EMA 50 is marked LOWER.

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 orange line is EMA 50. The dotted blue levels are the high and low of the latest mother bar. A green HIGHER triangle means a close above the mother bar's high with price above the EMA; a red LOWER triangle is the mirror case.

Indicators used

  • Inside bar pattern
  • EMA (50)

Same view with built-in indicators: Add an EMA (50) and mark inside bars and their mother bar by eye.

Default settings

Candles allowed for the breakout3
EMA period50

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

Key points

  1. An inside bar has a high below and a low above the candle before it, called the mother bar.
  2. It shows a pause in the market.
  3. We watch for the next three candles to close beyond the mother bar.
  4. A close above its high, with price above EMA 50, is marked HIGHER; below the low and below the EMA is LOWER.
  5. Markers confirm on a completed candle.
  6. Try it on the Practice balance and see how often the breakout holds.

Limitations. Breakouts of small inside bars are easily false, and a break against the trend is ignored by design. The article also covers a counter-trend inside bar reversal at support and resistance; this script only implements the breakout play with the trend. 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: 0b717a2a981fed56f8db885f011d841fa38cddf4466b770c65097bfe99f84f31

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Inside Bar Breakout v1.0.0
--
-- An inside bar is a candle whose range sits fully inside the previous
-- candle (the "mother bar"). It shows a pause. This script marks the first
-- close beyond the mother bar within a few candles, in the direction of the
-- EMA 50 side, so the breakout agrees with the wider trend.
--
-- HIGHER: within 3 candles after an inside bar, a candle closes above the
--         mother bar's high and the close is above EMA 50.
-- LOWER:  within 3 candles after an inside bar, a candle closes below the
--         mother bar's low and the close is below EMA 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 Inside Bar Breakout",
    short_name = "IQOW INSIDE",
    overlay = true
}

input_group {
    "1. Pattern",
    max_wait_bars = input (3, "Candles allowed for the breakout", input.integer, 1, 10)
}

input_group {
    "2. Trend filter",
    ema_period = input (50, "EMA period", input.integer, 2, 300)
}

input_group {
    "Display and advice",
    ema_visible = input { default = true, type = input.plot_visibility },
    mother_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 = "#FFB800", type = input.color },
    mother_color = input { default = rgba(86, 206, 255, 0.8), 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 }
}

ema_value = ema (close, ema_period)

local high_now = get_value (high, nil)
local low_now = get_value (low, nil)
local high_previous = get_value (high [1], nil)
local low_previous = get_value (low [1], nil)
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local ema_now = get_value (ema_value, nil)

local data_is_ready =
    high_now ~= nil and
    low_now ~= nil and
    high_previous ~= nil and
    low_previous ~= nil and
    close_previous ~= nil and
    ema_now ~= nil

-- Inside bar: high below and low above the previous candle (the mother bar).
local is_inside_bar = data_is_ready and high_now < high_previous and low_now > low_previous

-- Remember the latest mother bar range and how many candles ago it was set.
mother_high = iff (is_inside_bar, high [1], mother_high [1])
mother_low = iff (is_inside_bar, low [1], mother_low [1])
bars_since_inside = iff (is_inside_bar, 0, nz (bars_since_inside [1]) + 1)

local mother_high_now = get_value (mother_high, nil)
local mother_low_now = get_value (mother_low, nil)
local age = get_value (bars_since_inside, 0)
local inside_is_recent = mother_high_now ~= nil and mother_low_now ~= nil and
    age >= 1 and age <= max_wait_bars

-- Breakout candle: the close is beyond the mother bar for the first time
-- (the previous close was still inside or at the mother bar's edge).
local broke_up = data_is_ready and inside_is_recent and
    close_now > mother_high_now and close_previous <= mother_high_now
local broke_down = data_is_ready and inside_is_recent and
    close_now < mother_low_now and close_previous >= mother_low_now

higher_setup = conditional (broke_up and close_now > ema_now)
lower_setup = conditional (broke_down and close_now < ema_now)

-- 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_value, "EMA", ema_color, line_width)
end

if mother_visible then
    plot (mother_high, "Mother bar high", mother_color, line_width, 0, style.points)
    plot (mother_low, "Mother bar low", mother_color, line_width, 0, style.points)
end

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

    plot_shape (
        confirmed_lower,
        "Inside Bar 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
  • Intermediate

Pin Bar Inside Bar

Finds the pin bar and inside bar combo from the related article: a rejection candle followed by a candle that stays inside its range. The marker appears when price then closes beyond the pin bar in the direction of its wick.

Indicators: Pin bar candle geometry · Inside bar pattern

  • Price action
  • On price
  • Intermediate

RSI EMA200 Engulfing

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.

Indicators: EMA (200) · RSI (14, midline 50) · Engulfing candle

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

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.