iqow-demarker-30-70-cross.lua 4 KB · Free, MIT license
On assets priced above about 100 (such as JPY pairs) this script's panel can hide its markers, so import the markers file too: it draws them on the price chart.
For the IQ Option web traderoom. Quadcode does not draw HIGHER and LOWER markers on mobile.
Add it to IQ Option in 3 steps
- Get the file. Press Get the script. Your browser saves a .lua file.
- Import it in IQ Option. Open the web traderoom on the Practice balance. Click the wave icon at the bottom left of the chart, open the Scripts tab, press Import script and pick the file.
- Add it to the chart. The code opens in an editor. Click the plus button under it (Add to chart). Save is only needed after you edit the code.
Full illustrated guide, with screenshots → Watch the video
Risk. Trading can lose money. A marker is a chart observation, not a prediction, and this script is checked on test data, not proven in live trading. Try it on the Practice balance first.
- 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.
In the indicator panel the markers are drawn at the candle's price, so on assets priced above about 100 (for example JPY pairs) they fall outside the panel. Load demarker-30-70-cross-markers to see the same markers on the price chart.
Watch: install it and follow a Practice trade
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
| Period | 14 |
|---|---|
| Oversold level | 30 |
| Overbought level | 70 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- DeMarker measures whether each candle keeps making higher highs or lower lows.
- The line runs from 0 to 100. Below 30 is the oversold zone, above 70 is the overbought zone.
- We do not act inside the zone. We wait for the close back outside it.
- A close back above 30 is marked HIGHER; a close back below 70 is marked LOWER.
- The marker waits for the completed candle, so it does not repaint.
- 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.
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
- On price
- Beginner
Envelopes RSI
Marks a bounce from the Envelope lines: a candle reaches the outer line, closes back inside, and RSI confirms that price was stretched. It follows the 'bounce from the sides' method in the related article.
Indicators: Moving Average Envelopes (SMA 20, deviation 1) · RSI (14, 35/65)
- Reversal
- Own panel
- Intermediate
Fisher Transform Reversal
Marks a Fisher Transform cross of its trigger line while the indicator is in an extreme zone. This is the extreme-then-cross confirmation the related article describes.
Indicators: Ehlers Fisher Transform (10)
- 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)
Download all 84 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.