iqow-adx-ema28-cross.lua 5 KB · Free, MIT license
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 →
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.
- Trend
- On price
- Intermediate
Marks a candle that closes through the EMA 28 in the direction that +DI or -DI already favours. The DI lines act as a direction filter, the EMA cross as the trigger.
The rules
HIGHER marker
+DI(5) is above -DI(5) and a bullish candle closes above EMA 28 after the previous close was at or below it.
LOWER marker
-DI(5) is above +DI(5) and a bearish candle closes below EMA 28 after the previous close was at or above it.
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 blue line is EMA 28 on the price chart. A green HIGHER triangle under a candle means a bullish candle just closed above the EMA while +DI led; a red LOWER triangle above a candle is the mirror case. The DI lines are not drawn on the price chart, so add the native ADX indicator with period 5 in a panel to see them.
Indicators used
- ADX +DI / -DI (5)
- EMA (28)
Same view with built-in indicators: Add IQ Option's ADX (DI period 5) in a panel and an Exponential Moving Average with period 28 on the price chart.
Default settings
| DI period | 5 |
|---|---|
| EMA period | 28 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- This setup uses two ideas: the ADX directional lines and one EMA with period 28.
- +DI above -DI means upward moves are stronger than downward moves lately.
- The trigger is a candle that closes above the EMA after the previous close was at or below it, and the candle itself must be bullish.
- If -DI leads and a bearish candle closes below the EMA, the script marks LOWER.
- The marker appears only after the candle has closed, so it does not repaint.
- Test it on the Practice balance and look at how often price crosses the EMA when ADX is low.
Limitations. Price often crosses a 28-period EMA repeatedly in quiet or sideways markets, and each cross can pass the DI filter when the two DI lines are close together. Using the EMA slope or the ADX level as extra context is up to the trader. 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: 97598a557633a611f918c97c6c7796c0d66f3d7466d7d7e66b90f61af43435c0
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW ADX EMA28 Cross v1.0.0
--
-- Combines the directional indicators of ADX (+DI and -DI, period 5) with an
-- EMA 28 on price. +DI above -DI says buyers dominate the recent moves; a
-- candle closing through the EMA gives the timing. DI follows the official
-- ADX/DMS script of the Quadcode library.
--
-- HIGHER: +DI(5) is above -DI(5) and a bullish candle closes above EMA 28
-- after the previous close was at or below it.
-- LOWER: -DI(5) is above +DI(5) and a bearish candle closes below EMA 28
-- after the previous close was at or above it.
--
-- 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 ADX EMA28 Cross",
short_name = "IQOW ADX EMA",
overlay = true
}
input_group {
"1. ADX directional indicators",
di_period = input (5, "DI period", input.integer, 2, 100)
}
input_group {
"2. Moving average",
ema_period = input (28, "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 = "#56CEFF", type = input.color },
ema_width = input { default = 2, 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 }
}
-- Directional movement and DI, as in the official ADX/DMS script.
up_move = change (high)
down_move = -change (low)
plus_dm = iff (up_move > down_move and nz (up_move) > 0, up_move, 0)
minus_dm = iff (down_move > up_move and nz (down_move) > 0, down_move, 0)
average_range = max (rma (tr, di_period), 1e-10)
plus_di = 100 * rma (plus_dm / average_range, di_period)
minus_di = 100 * rma (minus_dm / average_range, di_period)
ema_line = ema (close, ema_period)
-- Current-bar scalars for the Lua rule logic.
local plus_now = get_value (plus_di, nil)
local minus_now = get_value (minus_di, nil)
local ema_now = get_value (ema_line, nil)
local ema_previous = get_value (ema_line [1], nil)
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local open_now = get_value (open, nil)
-- Wait until the EMA has a full period of history behind it.
local has_history = get_value (close [ema_period], nil) ~= nil
local data_is_ready =
has_history and
plus_now ~= nil and
minus_now ~= nil and
ema_now ~= nil and
ema_previous ~= nil and
close_now ~= nil and
close_previous ~= nil and
open_now ~= nil
-- Event: a bullish candle closes above the EMA after a close at or below it.
higher_setup = conditional (
data_is_ready and
plus_now > minus_now and
close_previous <= ema_previous and
close_now > ema_now and
close_now > open_now
)
-- Mirror: a bearish candle closes below the EMA after a close at or above it.
lower_setup = conditional (
data_is_ready and
minus_now > plus_now and
close_previous >= ema_previous and
close_now < ema_now and
close_now < open_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_line, "EMA", ema_color, ema_width)
end
if signals_visible then
plot_shape (
confirmed_higher,
"ADX EMA HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"ADX EMA 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 trend scripts
- Trend
- On price
- Intermediate
RSI Stochastic EMA200
Uses the EMA 200 as a trend filter, RSI 50 as a momentum filter and a Stochastic cross out of its extreme zone as the timing. It marks the end of a pullback in the direction of the larger trend.
Indicators: EMA (200) · RSI (14) · Stochastic (14, 3, 3)
- Trend
- On price
- Beginner
SMA 8 21 Cross
Marks the candle on which the 8-period simple moving average crosses the 21-period average and price closes beyond both lines. It is the classic two-average cross with a simple price check.
Indicators: SMA (8) · SMA (21)
- Trend
- On price
- Intermediate
Supertrend EMA 200
Marks Supertrend direction flips only when the candle closes on the same side of the 200-period EMA. The EMA acts as a simple long-term bias filter for the Supertrend flip.
Indicators: Supertrend (10, 3) · EMA (200)
Download all 70 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.