Three Candles Continuation Script

← All 56 scripts

  • Price action
  • On price
  • Beginner

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.

  • File iqow-three-candles-continuation.lua
  • Version 1.0.0
  • Size 156 lines · 5 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
Three Candles Continuation 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

Three bullish candles in a row, each with a body of at least 50% of its range and a higher close than the one before, with the third close above EMA 20.

LOWER marker

Three bearish candles in a row, each with a body of at least 50% of its range and a lower close than the one before, with the third close below EMA 20.

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 20. A green HIGHER triangle appears once on the third candle of a bullish run and a red LOWER triangle on the third candle of a bearish run; longer runs are marked only once. With the counter-trend option on, the markers are flipped and the EMA filter is ignored.

Indicators used

  • Three full candles
  • EMA (20)

Same view with built-in indicators: Add an EMA (20) and count three same-colour full-bodied candles by eye.

Default settings

Minimum body share of range0.5
EMA period20
Counter-trend readingoff

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

Key points

  1. Three candles of the same colour in a row show one side in control.
  2. We only count candles with a real body, so dojis and tiny candles do not qualify.
  3. Each close must also be beyond the previous one.
  4. The run must agree with EMA 20, and only the first completion is marked.
  5. The article uses the same run as a counter-trend idea, so the script has a switch for that reading.
  6. Compare both readings on the Practice balance.

Limitations. The article reads three same-colour candles as a reason to expect the opposite colour next, whereas this script defaults to the continuation reading its name describes; use the Counter-trend option for the article's version. Long runs often mean price is already extended, and the body-share default of 50% is an adaptation of the article's full-bodied candles. 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: 0bbcb70a61a03875e539aef9a9309a70b00c59953dfa6ab61325699185a3d404

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Three Candles Continuation v1.0.0
--
-- Marks the candle that completes a run of three same-colour candles with
-- steady closes, when price is on the matching side of EMA 20. Candles must
-- have a real body so doji and tiny candles do not count. One marker per run.
--
-- HIGHER: three bullish candles in a row, each closing above the previous
--         close, with the third close above EMA 20.
-- LOWER:  three bearish candles in a row, each closing below the previous
--         close, with the third close below EMA 20.
--
-- The related article reads the same three-candle run as a counter-trend
-- idea. Switch on "Counter-trend reading" to flip the markers: a bullish run
-- is then marked LOWER and a bearish run HIGHER, and the EMA filter is off.
--
-- 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 Three Candles Continuation",
    short_name = "IQOW 3 CANDLES",
    overlay = true
}

input_group {
    "1. Candle run",
    min_body_ratio = input (0.5, "Minimum body as share of range", input.double, 0.1, 0.95, 0.05, false),
    counter_trend = input { default = false, name = "Counter-trend reading (article)", type = input.boolean }
}

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

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 = "#FFB800", 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 ema_now = get_value (ema_value, nil)

-- A "full" candle has a body of at least min_body_ratio of its range.
-- Zero-range candles never qualify.
full_bullish = conditional (
    get_value (high - low, 0) > 0 and
    get_value (close - open, 0) >= min_body_ratio * get_value (high - low, 0)
)

full_bearish = conditional (
    get_value (high - low, 0) > 0 and
    get_value (open - close, 0) >= min_body_ratio * get_value (high - low, 0)
)

-- Wait until the EMA has a full period of history behind it.
local data_is_ready =
    ema_now ~= nil and
    get_value (close [ema_period], nil) ~= nil and
    get_value (close [2], nil) ~= nil

local three_up =
    data_is_ready and
    get_value (full_bullish, false) and
    get_value (full_bullish [1], false) and
    get_value (full_bullish [2], false) and
    close > close [1] and close [1] > close [2]

local three_down =
    data_is_ready and
    get_value (full_bearish, false) and
    get_value (full_bearish [1], false) and
    get_value (full_bearish [2], false) and
    close < close [1] and close [1] < close [2]

local above_ema = data_is_ready and get_value (close, 0) > ema_now
local below_ema = data_is_ready and get_value (close, 0) < ema_now

-- Continuation: run in the direction of EMA 20. Counter-trend: flipped, no EMA.
higher_setup = conditional (
    iff (counter_trend, three_down, three_up and above_ema)
)

lower_setup = conditional (
    iff (counter_trend, three_up, three_down and below_ema)
)

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

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

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

  • 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

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.