iqow-kdj-cross-markers.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.
- Reversal
- Marker companion
- On price
- Intermediate
Draws the HIGHER and LOWER markers of the KDJ Cross script on the price chart, above and below the candles, so they show on every asset, JPY pairs included. No lines: add KDJ Cross as well for the K, D and J lines.
This is the price-chart companion of KDJ Cross. It draws no lines, only the same HIGHER and LOWER markers, above and below the candles, so they show on every asset, JPY pairs included. Load both scripts and keep their settings equal.
The rules
HIGHER marker
%K crosses above %D on a candle where %J is below 20.
LOWER marker
%K crosses below %D on a candle where %J is above 80.
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
Markers only, on the price chart: a green HIGHER triangle below a candle and a red LOWER triangle above it, each on the candle that completed the setup of KDJ Cross. A marker appears after the next candle opens and does not move. The script draws no line, so add KDJ Cross (it opens in its own panel) to see the K, D and J lines. Both scripts use the same settings.
Indicators used
- KDJ (9, 3, 3)
Same view with built-in indicators: Add KDJ (9, 3, 3) with levels 20 and 80 from the IQ Option indicator list.
Default settings
| Stochastic period | 9 |
|---|---|
| K smoothing | 3 |
| D period | 3 |
| Low level (J) | 20 |
| High level (J) | 80 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- This is the price-chart companion of KDJ Cross: the same rule, the same settings and the same HIGHER and LOWER markers.
- A script in its own panel draws its markers at the candle's price on the panel's axis, so on JPY pairs and other assets priced above about 100 they fall outside the panel.
- The companion draws them above and below the candles instead, so they show on every asset.
- Each marker sits on the candle that completed the setup and appears after the next candle opens; it does not move or disappear.
- It draws no lines: add KDJ Cross to see the K, D and J lines in its own panel.
- Test both on a Practice balance first.
Limitations. Same setup and same limits as KDJ Cross: the markers describe the rule, not what the next candle will do. It draws no lines, so load the panel script to see why a marker appeared. Import both on the Practice balance and keep their settings equal. 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: 95dde2cdd6522c7b7f1f905bf2b6937ce1ee384fc0356be177b5a605434f3c75
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW KDJ Cross Markers v1.0.0
--
-- Price-chart companion of IQOW KDJ Cross (kdj-cross). It draws no lines: only
-- that script's HIGHER and LOWER markers, above and below the candles on the
-- price chart. A script with its own panel draws its markers at the candle's
-- price on the panel's axis, so on assets priced above about 100 (for example
-- JPY pairs) they fall outside the panel. Add IQOW KDJ Cross as well to see
-- the K, D and J lines. Keep the settings of both scripts equal.
--
-- KDJ extends the stochastic oscillator: K is the smoothed stochastic, D is
-- its moving average and J = 3K - 2D reacts faster than both. A K/D cross
-- with J already stretched marks a possible turn. K follows the KDJ panel
-- IQ Option draws.
--
-- The Stochastic follows IQ Option's built-in Stochastic Oscillator: the close
-- against the highest high and the lowest low of the %K period.
--
-- HIGHER: K crosses above D while J is below 20.
-- LOWER: K crosses below D while J is above 80.
--
-- 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 KDJ Cross Markers",
short_name = "MK KDJ",
overlay = true
}
input_group {
"1. KDJ settings",
k_period = input (9, "Stochastic period", input.integer, 2, 100),
k_smooth = input (3, "K smoothing", input.integer, 1, 50),
d_period = input (3, "D period", input.integer, 1, 50)
}
input_group {
"2. Levels",
low_level = input (20, "Low level (J)", input.double, 0, 45, 1, false),
high_level = input (80, "High level (J)", input.double, 55, 100, 1, false)
}
input_group {
"Display and advice",
signals_visible = input { default = true, type = input.plot_visibility },
advice_enabled = input { default = false, name = "Enable platform advice", type = input.boolean }
}
input_group {
"Colors",
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 }
}
-- KDJ: K = smoothed stochastic (0-100), D = SMA of K, J = 3K - 2D.
-- Stochastic as IQ Option's KDJ panel draws it: the close against the
-- highest high and lowest low of the %K period (not the highest and lowest
-- close), 50 when that range is zero. %K is that value smoothed with an SMA and
-- multiplied by 100; %D is an SMA of %K.
kdj_low = lowest (low, k_period)
kdj_range = highest (high, k_period) - kdj_low
kdj_raw = iff (kdj_range > 0, (close - kdj_low) / kdj_range, kdj_range + 0.5)
k_line = sma (kdj_raw, k_smooth) * 100
d_line = sma (k_line, d_period)
j_line = 3 * k_line - 2 * d_line
-- Current-bar scalars for the Lua rule logic.
local k_now = get_value (k_line, nil)
local k_before = get_value (k_line [1], nil)
local d_now = get_value (d_line, nil)
local d_before = get_value (d_line [1], nil)
local j_now = get_value (j_line, nil)
local data_is_ready =
low_level < high_level and
k_now ~= nil and
k_before ~= nil and
d_now ~= nil and
d_before ~= nil and
j_now ~= nil and
get_value (d_line [k_period + k_smooth], nil) ~= nil
-- Event: K crosses D on this candle while J is stretched.
higher_setup = conditional (
data_is_ready and k_before <= d_before and k_now > d_now and j_now < low_level
)
lower_setup = conditional (
data_is_ready and k_before >= d_before and k_now < d_now and j_now > high_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)
)
-- Markers on the price chart: HIGHER below the candle, LOWER above it. Offset -1
-- puts each one on the candle that completed the setup (the confirmation above
-- is evaluated when the next candle opens).
if signals_visible then
plot_shape (
confirmed_higher,
"KDJ HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"KDJ 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 reversal scripts
- Reversal
- On price
- Beginner
Donchian RSI Reversal
Marks the moment RSI leaves its oversold or overbought zone after price touched the matching Donchian band in the same excursion. The channel shows where price is stretched; RSI shows when momentum starts to turn.
Indicators: Donchian Channel (20) · RSI (14, 30/70)
- Reversal
- Own panel
- Intermediate
Double Stochastic
Marks the candle where a slow Stochastic confirms a reversal cross that the fast Stochastic already showed in the same oversold or overbought zone. Using two settings asks the same question on two time scales before a marker appears.
Indicators: Stochastic fast (8, 3, 5) · Stochastic slow (17, 3, 7)
- 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)
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.