Double Momentum 20 3 Script

← All 56 scripts

  • Momentum
  • Own panel
  • Beginner

Marks the candle where the fast Momentum(3) line crosses zero in the direction of the slower Momentum(20) line. The slow line gives the trend side, the fast line gives the timing.

  • File iqow-double-momentum-20-3.lua
  • Version 1.0.0
  • Size 131 lines · 4 KB
  • Timeframes 1-minute to 5-minute candles
  • License MIT
Double Momentum 20 3 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

Momentum(20) is above zero and Momentum(3) closes above zero after being at or below zero on the previous candle.

LOWER marker

Momentum(20) is below zero and Momentum(3) closes below zero after being at or above zero on the previous candle.

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 script runs in a separate panel under the price chart. The yellow line is Momentum(20), the blue line is Momentum(3) and the faint horizontal line is zero. A green HIGHER triangle at the bottom or a red LOWER triangle at the top marks the candle where the blue line crossed zero with the yellow line on the same side.

Indicators used

  • Momentum (20)
  • Momentum (3)

Same view with built-in indicators: Add two Momentum indicators (Momentum, source Close) with periods 20 and 3 and compare both lines with the zero line.

Default settings

Trend Momentum period20
Trigger Momentum period3

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

Key points

  1. Momentum simply compares the close with the close a set number of candles ago.
  2. Momentum 20 above zero says price is higher than 20 candles back, so the trend side is up.
  3. Momentum 3 is the fast line. We wait for it to close above zero after sitting at or below it.
  4. When both agree, the script marks HIGHER; the mirror case marks LOWER.
  5. Markers confirm on a completed candle, so they do not repaint while a candle is forming.
  6. Try it on the Practice balance and compare trending hours with sideways hours.

Limitations. Momentum(3) crosses zero often when price chops sideways, and the slow filter lags at turning points, so some markers appear against a move that is already fading. It suits clear trends better than ranges. Test on the Practice balance before risking real funds.

Learn the strategy: read the full guide on IQOptionWiki →

Install it in four steps

  1. Download and inspectDownload one .lua file and open it in a plain-text editor if you want to read it first. If you downloaded the ZIP, extract it.
  2. Open Chart Analysis → ScriptsIn the IQ Option traderoom, choose the Practice balance, open the chart analysis panel, select Scripts and choose Import script.
  3. Save and add to chartSelect the downloaded file, review the imported code, choose Save, then use the + control to add it to the chart.
  4. Change one input at a timeConfirm the default view first. Then adjust periods, levels or colours one setting at a time and note what changes.

Complete source code

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

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Double Momentum 20 3 v1.0.0
--
-- Two Momentum lines on the same chart. Momentum is the close minus the close
-- N candles ago, so it sits above zero when price is higher than it was N
-- candles back. Momentum(20) is the trend filter; Momentum(3) is the trigger.
--
-- HIGHER: Momentum(20) is above zero and Momentum(3) closes above zero after
--         being at or below zero on the previous candle.
-- LOWER:  Momentum(20) is below zero and Momentum(3) closes below zero after
--         being at or above zero on the previous candle.
--
-- 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 Momentum 20 3",
    short_name = "IQOW MOM 20/3",
    overlay = false
}

input_group {
    "1. Momentum settings",
    trend_period = input (20, "Trend Momentum period", input.integer, 2, 200),
    trigger_period = input (3, "Trigger Momentum period", input.integer, 1, 100)
}

input_group {
    "Display and advice",
    lines_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",
    trend_color = input { default = "#DBCF0D", type = input.color },
    trigger_color = input { default = "#56CEFF", type = input.color },
    zero_color = input { default = rgba(255, 255, 255, 0.25), 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 }
}

-- Momentum = close - close[N].
trend_momentum = change (close, trend_period)
trigger_momentum = change (close, trigger_period)

-- Current-bar scalars for the Lua rule logic.
local trend_now = get_value (trend_momentum, nil)
local trigger_now = get_value (trigger_momentum, nil)
local trigger_previous = get_value (trigger_momentum [1], nil)

-- The trigger must be the faster of the two lines.
local periods_are_valid = trigger_period < trend_period

local data_is_ready =
    periods_are_valid and
    trend_now ~= nil and
    trigger_now ~= nil and
    trigger_previous ~= nil

-- Event: the trigger closes across zero on this candle while the trend
-- Momentum already sits on the same side of zero.
higher_setup = conditional (
    data_is_ready and trend_now > 0 and trigger_previous <= 0 and trigger_now > 0
)

lower_setup = conditional (
    data_is_ready and trend_now < 0 and trigger_previous >= 0 and trigger_now < 0
)

-- 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
    hline (0, "Zero", zero_color, 1)
    plot (trend_momentum, "Momentum trend", trend_color, line_width)
    plot (trigger_momentum, "Momentum trigger", trigger_color, line_width)
end

if signals_visible then
    plot_shape (
        confirmed_higher,
        "MOM 20/3 HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.bottom,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "MOM 20/3 LOWER",
        shape_style.triangledown,
        shape_size.small,
        lower_color,
        shape_location.top,
        -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 momentum scripts

  • Momentum
  • Own panel
  • Intermediate

Woodies CCI

Marks a Woodies CCI zero-line cross: the 14-period CCI changes side after six candles on the other side, while the faster Turbo CCI already agrees. The zero line is the baseline the article uses to define trend side.

Indicators: CCI (14) · Turbo CCI (6)

  • Momentum
  • Context indicator
  • Own panel
  • Beginner

Price EMA Distance Percent

Shows how far the selected price source is above or below an EMA in percentage terms. A configurable reference zone helps compare the current distance with your chosen scale.

Indicators: EMA (20) distance in %

  • Momentum
  • Signal engine
  • On price
  • Advanced

IQ_WIKI_SCRIP_V1.1.0

A completed-candle adaptation of the regular IQOptionWiki Signals score. It weighs RSI, MACD, Bollinger %B, five directional candle patterns and optional chart-volume confirmation into one score and marks new qualifying setups.

Indicators: RSI · MACD · Bollinger %B (population deviation) · Five candlestick patterns · Optional chart volume

Download all 56 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.