iqow-double-stochastic-markers.lua 7 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 Double Stochastic script on the price chart, above and below the candles, so they show on every asset, JPY pairs included. No lines: add Double Stochastic as well for the four Stochastic lines.
This is the price-chart companion of Double Stochastic. 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
The fast Stochastic %K crossed above its %D at or below 20 within the last 5 candles, and the slow %K now crosses above its %D at or below 20.
LOWER marker
The fast Stochastic %K crossed below its %D at or above 80 within the last 5 candles, and the slow %K now crosses below its %D at or 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 Double Stochastic. A marker appears after the next candle opens and does not move. The script draws no line, so add Double Stochastic (it opens in its own panel) to see the four Stochastic lines. Both scripts use the same settings.
Indicators used
- Stochastic fast (8, 3, 5)
- Stochastic slow (17, 3, 7)
Same view with built-in indicators: Add two Stochastic Oscillators: one with %K 8, %D 3, smoothing 5 and one with %K 17, %D 3, smoothing 7, both with levels 80 and 20.
Default settings
| Fast %K / %D / smoothing | 8 / 3 / 5 |
|---|---|
| Slow %K / %D / smoothing | 17 / 3 / 7 |
| Oversold | 20 |
| Overbought | 80 |
| Fast cross memory (candles) | 5 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- This is the price-chart companion of Double Stochastic: 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 Double Stochastic to see the four Stochastic lines in its own panel.
- Test both on a Practice balance first.
Limitations. Same setup and same limits as Double Stochastic: 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: 8a47718ce90ac82da93a4bc649b0ae5d345e42f34826d02ec40ff79553cc839d
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Double Stochastic Markers v1.0.0
--
-- Price-chart companion of IQOW Double Stochastic (double-stochastic). 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
-- Double Stochastic as well to see the four Stochastic lines. Keep the
-- settings of both scripts equal.
--
-- Two Stochastic oscillators with different settings. The fast one (8, 3, 5)
-- gives the first reversal hint; the slow one (17, 3, 7) confirms it, as the
-- IQOptionWiki Double Stochastic article describes. Settings are %K period,
-- %D period and %K smoothing.
--
-- 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: the fast %K crossed above its %D in the oversold zone (at or below 20)
-- within the last few candles, and now the slow %K crosses above its %D
-- while also in the oversold zone.
-- LOWER: the mirror case: fast cross down in the overbought zone (at or above
-- 80), then the slow %K crosses below its %D in the overbought zone.
--
-- 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 Double Stochastic Markers",
short_name = "MK 2xSTOCH",
overlay = true
}
input_group {
"1. Fast Stochastic",
fast_k_period = input (8, "%K period", input.integer, 2, 100),
fast_d_period = input (3, "%D period", input.integer, 1, 50),
fast_smooth = input (5, "%K smoothing", input.integer, 1, 50)
}
input_group {
"2. Slow Stochastic (confirmation)",
slow_k_period = input (17, "%K period", input.integer, 2, 100),
slow_d_period = input (3, "%D period", input.integer, 1, 50),
slow_smooth = input (7, "%K smoothing", input.integer, 1, 50)
}
input_group {
"3. Zones and timing",
oversold_level = input (20, "Oversold level", input.double, 5, 45, 1, false),
overbought_level = input (80, "Overbought level", input.double, 55, 95, 1, false),
fast_memory = input (5, "Fast cross memory (candles)", input.integer, 1, 20)
}
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 }
}
-- Stochastic as IQ Option's built-in oscillator 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.
fast_low = lowest (low, fast_k_period)
fast_range = highest (high, fast_k_period) - fast_low
fast_raw = iff (fast_range > 0, (close - fast_low) / fast_range, fast_range + 0.5)
fast_k = sma (fast_raw, fast_smooth) * 100
fast_d = sma (fast_k, fast_d_period)
slow_low = lowest (low, slow_k_period)
slow_range = highest (high, slow_k_period) - slow_low
slow_raw = iff (slow_range > 0, (close - slow_low) / slow_range, slow_range + 0.5)
slow_k = sma (slow_raw, slow_smooth) * 100
slow_d = sma (slow_k, slow_d_period)
-- Current and previous values for the rule logic.
local fast_k_now = get_value (fast_k, nil)
local fast_d_now = get_value (fast_d, nil)
local fast_k_before = get_value (fast_k [1], nil)
local fast_d_before = get_value (fast_d [1], nil)
local slow_k_now = get_value (slow_k, nil)
local slow_d_now = get_value (slow_d, nil)
local slow_k_before = get_value (slow_k [1], nil)
local slow_d_before = get_value (slow_d [1], nil)
local levels_are_valid = oversold_level < 50 and overbought_level > 50
local data_is_ready =
levels_are_valid and
fast_k_now ~= nil and fast_d_now ~= nil and
fast_k_before ~= nil and fast_d_before ~= nil and
slow_k_now ~= nil and slow_d_now ~= nil and
slow_k_before ~= nil and slow_d_before ~= nil
-- Fast Stochastic cross inside its extreme zone (first hint).
fast_cross_up = conditional (
data_is_ready and
fast_k_before <= fast_d_before and fast_k_now > fast_d_now and
fast_k_now <= oversold_level
)
fast_cross_down = conditional (
data_is_ready and
fast_k_before >= fast_d_before and fast_k_now < fast_d_now and
fast_k_now >= overbought_level
)
-- Did the fast cross happen on this candle or within the memory window?
local function seen_recently (event, bars)
if get_value (event, false) then
return true
end
for back = 1, bars - 1 do
if get_value (event [back], false) then
return true
end
end
return false
end
local fast_up_recent = seen_recently (fast_cross_up, fast_memory)
local fast_down_recent = seen_recently (fast_cross_down, fast_memory)
-- Slow Stochastic cross inside the same zone (confirmation).
local slow_cross_up =
data_is_ready and
slow_k_before <= slow_d_before and slow_k_now > slow_d_now and
slow_k_now <= oversold_level
local slow_cross_down =
data_is_ready and
slow_k_before >= slow_d_before and slow_k_now < slow_d_now and
slow_k_now >= overbought_level
higher_setup = conditional (slow_cross_up and fast_up_recent)
lower_setup = conditional (slow_cross_down and fast_down_recent)
-- 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,
"2xSTOCH HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"2xSTOCH 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
- Own panel
- Beginner
DeMarker 30 70 Cross
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.
Indicators: DeMarker (14, levels 30/70)
- 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)
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.