DeMarker 30 70 Cross Script

← All 56 scripts

  • Reversal
  • Own panel
  • Beginner

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.

  • File iqow-demarker-30-70-cross.lua
  • Version 1.0.0
  • Size 135 lines · 4 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
DeMarker 30 70 Cross 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

DeMarker(14) closes above 30 after being at or below 30 on the previous candle.

LOWER marker

DeMarker(14) closes below 70 after being at or above 70 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 script runs in a separate panel. The blue line is DeMarker (0-100) and the two faint lines are the 30 and 70 levels. A green HIGHER triangle at the bottom marks the candle where the line closed back above 30; a red LOWER triangle at the top marks a close back below 70.

Indicators used

  • DeMarker (14, levels 30/70)

Same view with built-in indicators: Add IQ Option's DeMarker indicator with period 14, overbought 70 and oversold 30.

Default settings

Period14
Oversold level30
Overbought level70

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

Key points

  1. DeMarker measures whether each candle keeps making higher highs or lower lows.
  2. The line runs from 0 to 100. Below 30 is the oversold zone, above 70 is the overbought zone.
  3. We do not act inside the zone. We wait for the close back outside it.
  4. A close back above 30 is marked HIGHER; a close back below 70 is marked LOWER.
  5. The marker waits for the completed candle, so it does not repaint.
  6. Practise on the Practice balance and watch what happens when DeMarker stays in a zone during a trend.

Limitations. In a persistent trend DeMarker can stay below 30 or above 70 for a long time, and a cross back is then only a pause. The line also moves quickly on short candles, so crosses can cluster. 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: c96e8032ec7c82d60901e236c931350c09079e7300c4c3092050a7a05577d0c0

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW DeMarker 30 70 Cross v1.0.0
--
-- DeMarker(14) compares each candle's new highs and new lows with the
-- previous candle, then scales the result to 0-100 (formula from the official
-- Quadcode DeMarker script). Low values mean sellers keep making new lows;
-- high values mean buyers keep making new highs.
--
-- HIGHER: DeMarker closes above the oversold level (30) after being at or
--         below it on the previous candle.
-- LOWER:  DeMarker closes below the overbought level (70) after being at or
--         above it 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 DeMarker 30 70 Cross",
    short_name = "IQOW DEM 30/70",
    overlay = false
}

input_group {
    "1. DeMarker settings",
    dem_period = input (14, "Period", input.integer, 2, 100),
    oversold_level = input (30, "Oversold level", input.double, 1, 49, 1, false),
    overbought_level = input (70, "Overbought level", input.double, 51, 99, 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",
    dem_color = input { default = "#56CEFF", type = input.color },
    level_color = input { default = rgba(255, 255, 255, 0.35), type = input.color },
    dem_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 }
}

-- DeMarker: average of new highs over the sum of new highs and new lows.
dem_max = max (high - high [1], 0)
dem_min = max (low [1] - low, 0)

average_max = sma (dem_max, dem_period)
average_min = sma (dem_min, dem_period)
total_range = average_max + average_min

-- A flat market (no new highs or lows) reads as neutral 50.
dem_value = iff (total_range > 0, 100 * average_max / max (total_range, 1e-10), 50)

-- Current-bar scalars for the Lua rule logic.
local dem_now = get_value (dem_value, nil)
local dem_previous = get_value (dem_value [1], nil)

local levels_are_valid = oversold_level < overbought_level

local data_is_ready =
    levels_are_valid and
    dem_now ~= nil and
    dem_previous ~= nil

-- Event: DeMarker closes back across a level on this candle.
higher_setup = conditional (
    data_is_ready and dem_previous <= oversold_level and dem_now > oversold_level
)

lower_setup = conditional (
    data_is_ready and dem_previous >= overbought_level and dem_now < overbought_level
)

-- 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
    hline (oversold_level, "Oversold", level_color, 1)
    hline (overbought_level, "Overbought", level_color, 1)
    plot (dem_value, "DeMarker", dem_color, dem_width)
end

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

    plot_shape (
        confirmed_lower,
        "DEM 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
  • 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)

  • Reversal
  • On price
  • Intermediate

Morning Evening Star RSI

Marks morning star and evening star candle patterns when RSI on the middle candle was at a low or high zone. RSI helps check that the pattern follows a push in the opposite direction.

Indicators: Morning and evening star candles · RSI (14, 40/60)

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.