iqow-zscore-fade-pro.lua 8 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
- On price
- Intermediate
A stricter Z-Score Fade: it marks the first 1-minute candle that reaches 2 standard deviations from its SMA(40), but only while price is not chasing far from its EMA(100) and, by default, only when Supertrend agrees with the fade.
The rules
HIGHER marker
The z-score falls to or below -2 and the previous z-score was above -2, the close is within 3 ATR(14) of the EMA(100), and Supertrend(10, 3) is up.
LOWER marker
The z-score rises to or above +2 and the previous z-score was below +2, the close is within 3 ATR(14) of the EMA(100), and Supertrend(10, 3) is down.
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 purple lines are the SMA(40) plus and minus two standard deviations. A green HIGHER triangle means price stretched below the lower band while the candle was still near the EMA(100) and Supertrend pointed up. A red LOWER triangle is the mirror case above the upper band. If you switch a filter off, more markers appear, but the research setting uses both.
Indicators used
- Z-score (SMA 40, 2 population deviations)
- EMA 100 and ATR 14 chase filter
- Supertrend (10, 3)
Same view with built-in indicators: Add IQ Option's Bollinger Bands (40, 2) and Supertrend (10, 3), then read the z-score from the bands and keep the EMA(100) for the chase filter.
Default settings
| SMA and deviation period | 40 |
|---|---|
| Standard deviations from the SMA | 2 |
| Use the EMA distance filter | on |
| EMA period | 100 |
| Maximum distance from the EMA in ATR | 3 |
| Use the Supertrend filter | on |
| Supertrend ATR period | 10 |
| Supertrend ATR multiplier | 3 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- A z-score turns the distance from a moving average into standard deviations, so the same threshold works on every crypto pair.
- This pro version waits for a 2-deviation stretch on a 40-candle average instead of the 3-deviation stretch of the basic script.
- The chase filter blocks signals when price is already more than 3 ATR away from its EMA(100), where a fade is usually too late.
- The Supertrend filter keeps only the fades that agree with the short-term direction of the trailing line.
- The research window was 16:00 to 20:30 UTC: the script cannot read a clock, so you must choose the session yourself.
- The measured edge shrinks within seconds; treat the marker as a study aid, not a signal you can always act on.
What the research found
The evidence behind this script
The rule behind this script is the frozen crypto scout config zscore-fade(n=40,k=2) with the chase and Supertrend filters, scored by the same weekly method as the rest of the library.
- Older windows 2016-2026
- 59.5%
- Unseen days 1-6 Nov
- 71.8%
- After a 5-second entry delay
- 56.8%
- 92-day walk-forward, basic script
- 52.1%
33,949 trades; above break-even in 28 of 36 windows
39 trades; too few to rely on
1,029 trades; only just above break-even
7,733 trades; below the 54.05% break-even at 85% payout
The 71.8% comes from a short unseen sample and should not be quoted as an expected result. The older-window number is the more useful one, and it still depends on a fast entry.
Limitations. Crypto pairs only: in the internal research the same rule had no edge on forex pairs. The script has no clock, so the tested session (16:00 to 20:30 UTC) must be chosen by the trader. The edge fades with entry delay: on the 1-second test it fell to 56.8% after five seconds, so it needs a fast entry. Internal iqoptionwiki backtest only. 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: b57162fce9c2c959a2b121836331f65833c0d6139a33ad5211c81e4b3f3ab831
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Z-Score Fade Pro v1.0.0
--
-- A stricter version of Z-Score Fade. It marks the first candle whose close
-- reaches 2 population standard deviations from its SMA(40), but only when the
-- candle is not already far from the EMA(100) (the chase filter) and, if you
-- enable it, only when the Supertrend(10, 3) direction agrees with the fade.
-- It is built for 1-minute candles and expiries of about 1 to 3 minutes.
--
-- HIGHER: z falls to or below -2 and the previous z was above -2, the close is
-- within 3 ATR(14) of the EMA(100), and (optional) Supertrend is up.
-- LOWER: z rises to or above +2 and the previous z was below +2, the close is
-- within 3 ATR(14) of the EMA(100), and (optional) Supertrend is down.
--
-- The script has no clock. The internal research used 16:00 to 20:30 UTC; it
-- still marks outside that window, so you must choose when you use 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 Z-Score Fade Pro",
short_name = "IQOW ZFADE PRO",
overlay = true
}
input_group {
"1. Z-score bands",
z_period = input (40, "SMA and deviation period", input.integer, 5, 200),
z_threshold = input (2, "Standard deviations from the SMA", input.double, 1, 6, 0.1, false)
}
input_group {
"2. Chase filter",
chase_filter_enabled = input { default = true, name = "Use the EMA distance filter", type = input.boolean },
ema_period = input (100, "EMA period", input.integer, 2, 500),
max_chase_atr = input (3, "Maximum distance from the EMA in ATR", input.double, 0.5, 10, 0.1, false)
}
input_group {
"3. Supertrend filter",
supertrend_filter_enabled = input { default = true, name = "Use the Supertrend filter", type = input.boolean },
supertrend_atr_period = input (10, "Supertrend ATR period", input.integer, 1, 100),
supertrend_multiplier = input (3, "Supertrend ATR multiplier", input.double, 0.5, 10, 0.1, false)
}
input_group {
"Display and advice",
lines_visible = input { default = true, type = input.plot_visibility },
middle_visible = input { default = true, type = input.plot_visibility },
filter_lines_visible = input { default = false, 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",
band_color = input { default = "#9B59B6", type = input.color },
band_fill_color = input { default = rgba(155, 89, 182, 0.08), type = input.color },
middle_color = input { default = "#FF7700", type = input.color },
chase_color = input { default = "#56CEFF", type = input.color },
supertrend_up_color = input { default = "#25E154", type = input.color },
supertrend_down_color = input { default = "#FF6C58", type = input.color },
line_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 }
}
-- Bands: SMA plus and minus z_threshold population standard deviations
-- (stdev is the sample form, so it is scaled by sqrt ((n - 1) / n)).
middle_line = sma (close, z_period)
deviation = stdev (close, z_period) * math.sqrt ((z_period - 1) / z_period)
upper_band = middle_line + z_threshold * deviation
lower_band = middle_line - z_threshold * deviation
z_score = (close - middle_line) / max (deviation, 1e-10)
-- Chase filter: distance from the EMA in ATR units.
atr_value = rma (tr, 14)
ema_line = ema (close, ema_period)
chase_distance = abs (close - ema_line) / max (atr_value, 1e-10)
-- Supertrend, same recursion as the official library indicator.
band_offset = rma (tr, supertrend_atr_period) * supertrend_multiplier
raw_up = hl2 - band_offset
raw_down = hl2 + band_offset
trail_up = iff (not na (trail_up) and close [1] > trail_up [1], max (raw_up, trail_up [1]), raw_up)
trail_down = iff (not na (trail_down) and close [1] < trail_down [1], min (raw_down, trail_down [1]), raw_down)
trend_is_up = iff (close > trail_down [1], true, iff (close < trail_up [1], false, nz (trend_is_up [1], true)))
-- Current-bar scalars for the Lua rule logic.
local z_now = get_value (z_score, nil)
local z_previous = get_value (z_score [1], nil)
local deviation_now = get_value (deviation, nil)
local middle_now = get_value (middle_line, nil)
local chase_now = get_value (chase_distance, nil)
local ema_now = get_value (ema_line, nil)
local atr_now = get_value (atr_value, nil)
local trend_now = get_value (trend_is_up, nil)
local trend_before = get_value (trend_is_up [1], nil)
local trail_before = get_value (trail_up [1], nil)
local chase_ready = (not chase_filter_enabled) or (chase_now ~= nil and ema_now ~= nil and atr_now ~= nil and atr_now > 0)
local trend_ready = (not supertrend_filter_enabled) or (trend_now ~= nil and trend_before ~= nil and trail_before ~= nil)
local data_is_ready =
z_now ~= nil and
z_previous ~= nil and
deviation_now ~= nil and deviation_now > 0 and
middle_now ~= nil and
chase_ready and
trend_ready
local chase_allows = (not chase_filter_enabled) or (chase_ready and chase_now <= max_chase_atr)
-- First candle that crosses the outer z-score level.
local higher_event = data_is_ready and z_previous > -z_threshold and z_now <= -z_threshold
local lower_event = data_is_ready and z_previous < z_threshold and z_now >= z_threshold
local higher_trend_allows = (not supertrend_filter_enabled) or (trend_ready and trend_now)
local lower_trend_allows = (not supertrend_filter_enabled) or (trend_ready and not trend_now)
higher_setup = conditional (higher_event and chase_allows and higher_trend_allows)
lower_setup = conditional (lower_event and chase_allows and lower_trend_allows)
-- 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
fill (upper_band, lower_band, "Z-score area", band_fill_color)
plot (upper_band, "Upper z-score band", band_color, line_width)
plot (lower_band, "Lower z-score band", band_color, line_width)
end
if middle_visible then
plot (middle_line, "SMA", middle_color, 1)
end
if filter_lines_visible then
if chase_filter_enabled then
plot (ema_line, "EMA chase filter", chase_color, line_width)
end
if supertrend_filter_enabled then
plot (iff (trend_is_up, trail_up, trail_down), "Supertrend", get_value (trend_is_up, true) and supertrend_up_color or supertrend_down_color, line_width)
end
end
if signals_visible then
plot_shape (
confirmed_higher,
"ZPRO HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"ZPRO 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
- 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)
- Reversal
- Own panel
- Beginner
RSI Law
Marks the candle on which a short RSI(5) closes back across the 30 or 70 line after an excursion into the extreme zone. This is the RSI Law rule from the related article, shown as completed-candle markers.
Indicators: RSI (5, 30/70)
- Reversal
- On price
- Beginner
STARC Bands Reversal
Marks a bullish or bearish candle that closes back inside the STARC Bands after the previous close was outside them. The bands show where price is stretched in ATR terms.
Indicators: STARC Bands (SMA 6, ATR 15, x2)
Download all 74 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.