Z-Score Fade Script

← All 74 scripts

iqow-zscore-fade.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

  1. Get the file. Press Get the script. Your browser saves a .lua file.
  2. 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.
  3. 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.

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

Marks the first 1-minute candle that closes 3 standard deviations away from its SMA(20), expecting a short snap back toward the average. It is a plain statistical-stretch setup for crypto pairs.

  • File iqow-zscore-fade.lua
  • Version 1.0.0
  • Size 144 lines · 5 KB
  • Timeframes 1-minute candles
  • License MIT
Z-Score Fade drawn on synthetic candles
How the script draws, shown on synthetic candles generated for testing. It is an illustration of the markers and lines, not real market data or a result.

The rules

HIGHER marker

The close is at or below SMA(20) minus 3 standard deviations and the previous close was still above its own lower band.

LOWER marker

The close is at or above SMA(20) plus 3 standard deviations and the previous close was still below its own upper band.

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 band is SMA(20) plus and minus 3 standard deviations and the orange line is the SMA. A green HIGHER triangle under a candle marks a close on or below the lower band; a red LOWER triangle above a candle marks a close on or above the upper band.

Indicators used

  • Z-score bands (SMA 20, 3 standard deviations)

Same view with built-in indicators: Add Bollinger Bands (period 20, deviation 3) on the price chart and watch for a close on or outside the outer band.

Default settings

SMA and deviation period20
Standard deviations from the SMA3

Every value is an input in the script settings. Platform advice is off by default.

Key points

  1. A z-score says how far the close is from its average, measured in standard deviations.
  2. Here the average is a 20-candle SMA and the distance is 3 standard deviations.
  3. The first candle that closes on or beyond the band gets a marker.
  4. The idea is a short snap back toward the average, so it is meant for 1-minute candles and very short expiries.
  5. The script has no clock, so you choose the hours you use it in.
  6. Test on a Practice balance first.

Limitations. Crypto pairs only: in the internal research it showed no edge on forex pairs. The script has no clock, so any time-of-day window (the internal research used 16:00 to 20:30 UTC) must be chosen by the trader. The setup fails in strong one-way moves where price keeps running past the band. Internal iqoptionwiki backtest only. Test on the Practice balance before risking real funds.

Learn the strategy: read the full guide on IQOptionWiki →

Complete source code

The download and this preview resolve to the same reviewed file. SHA-256: dd8a50891629e2ecbe271f35fddbd2a2d38dca7c6aeb793fbd03f8cfabe2b46d

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Z-Score Fade v1.0.0
--
-- The z-score measures how many standard deviations the close is from its simple
-- moving average. This script marks the first candle on which the close moves out
-- to 3 standard deviations from the SMA(20) (the outer Bollinger-style band) and
-- expects a snap back toward the average. It is built for 1-minute candles with a
-- 1 to 3 minute expiry. Standard deviation here is the population form, as used
-- in the internal research.
--
-- HIGHER: the close falls to or below SMA(20) minus 3 standard deviations, and the
--         previous close was still above its own lower band.
-- LOWER:  the close rises to or above SMA(20) plus 3 standard deviations, and the
--         previous close was still below its own upper band.
--
-- The script has no clock. Run it only in the time window you choose (the
-- internal research used 16:00 to 20:30 UTC); outside that window it still marks.
--
-- 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",
    short_name = "IQOW ZFADE",
    overlay = true
}

input_group {
    "1. Z-score bands",
    z_period = input (20, "SMA and deviation period", input.integer, 5, 200),
    z_threshold = input (3, "Standard deviations from the SMA", input.double, 1, 6, 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 },
    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 },
    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

local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local upper_now = get_value (upper_band, nil)
local lower_now = get_value (lower_band, nil)
local upper_previous = get_value (upper_band [1], nil)
local lower_previous = get_value (lower_band [1], nil)
local deviation_now = get_value (deviation, nil)

local data_is_ready =
    close_now ~= nil and close_previous ~= nil and
    upper_now ~= nil and lower_now ~= nil and
    upper_previous ~= nil and lower_previous ~= nil and
    deviation_now ~= nil and deviation_now > 0

-- First candle that reaches the outer band (the previous one was still inside).
higher_setup = conditional (
    data_is_ready and close_now <= lower_now and close_previous > lower_previous
)

lower_setup = conditional (
    data_is_ready and close_now >= upper_now and close_previous < upper_previous
)

-- 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 signals_visible then
    plot_shape (
        confirmed_higher,
        "ZFADE HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "ZFADE 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
IQOW Top 1086Rank #426 walk-forward windows · 327,508 trades tested

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
IQOW Score74Rank #1126 walk-forward windows · 2,586,944 trades tested

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
IQOW Top 1084Rank #526 walk-forward windows · 872,566 trades tested

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 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.

GENERAL RISK WARNING

The financial products offered by the company carry a high level of risk and can result in the loss of all your funds. You should never invest money that you cannot afford to lose.
Kindly note that this article does not provide any investment advice. The information presented regarding past events or potential future developments is solely an opinion and cannot be guaranteed as factual, including the provided examples. We caution readers accordingly.