EMA Momentum Script

← All 56 scripts

  • Momentum
  • On price
  • Beginner

Marks the candle that completes two events: price closes across the EMA(20) and the Momentum(20) line crosses zero, within a few candles of each other. Both must still be true on the marked candle.

  • File iqow-ema-momentum.lua
  • Version 1.0.0
  • Size 160 lines · 6 KB
  • Timeframes 30-minute candles and longer (article); can be tried on shorter ones
  • License MIT
EMA Momentum 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) crosses above zero and a candle closes above EMA(20), the two events no more than 3 candles apart, with the close above the EMA and Momentum above zero on the marked candle.

LOWER marker

Momentum(20) crosses below zero and a candle closes below EMA(20), the two events no more than 3 candles apart, with the close below the EMA and Momentum below zero on the marked 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 yellow line is EMA(20). A green HIGHER triangle under a candle means price has crossed above the EMA and Momentum has crossed above zero within the last few candles; a red LOWER triangle above a candle is the mirror case. Momentum itself is not drawn on the price chart.

Indicators used

  • EMA (20)
  • Momentum (20)

Same view with built-in indicators: Add IQ Option's Moving Average of type EMA (20) and the Momentum indicator (20).

Default settings

EMA period20
Momentum period20
Maximum candles between the events3

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

Key points

  1. Momentum simply compares today's close with the close 20 candles ago.
  2. When Momentum crosses above zero, price is now higher than it was 20 candles back.
  3. The EMA 20 tells us whether price is closing above or below its recent average.
  4. We need both events: the EMA cross and the Momentum zero cross, no more than three candles apart.
  5. The marker appears on the candle that completes the pair, confirmed one candle later.
  6. The article warns against sideways markets, so check the trend first and use a Practice balance.

Limitations. The article says this setup works in trends and not in sideways markets, where price and Momentum cross their lines repeatedly. The article's exit signals are not drawn. 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: b5f17a80480b558b225ae63d82e862119a24164bcbe0df2892a6587dca972b63

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW EMA Momentum v1.0.0
--
-- Combines an EMA (20) with the Momentum indicator (20), as in the related
-- article. Momentum is the close minus the close N candles ago, so crossing zero
-- means price is now above or below where it was N candles back. The EMA shows
-- which side of the average price closed. The article allows the two events to
-- happen up to 3 candles apart.
--
-- HIGHER: Momentum crosses above zero and a candle closes above the EMA, both
--         events within the last 3 candles, with both conditions true now.
-- LOWER:  Momentum crosses below zero and a candle closes below the EMA, both
--         events within the last 3 candles, with both conditions true now.
--
-- 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 EMA Momentum",
    short_name = "IQOW EMA MOM",
    overlay = true
}

input_group {
    "1. EMA and Momentum",
    ema_period = input (20, "EMA period", input.integer, 2, 300),
    momentum_period = input (20, "Momentum period", input.integer, 2, 200),
    event_window = input (3, "Max candles between the two events", input.integer, 1, 5)
}

input_group {
    "Display and advice",
    ema_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",
    ema_color = input { default = "#FFD166", type = input.color },
    ema_width = input { default = 2, 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 }
}

trend_ema = ema (close, ema_period)
-- Momentum = close minus the close N candles ago (official Momentum indicator).
momentum_value = close - close [momentum_period]

local ema_now = get_value (trend_ema, nil)
local ema_previous = get_value (trend_ema [1], nil)
local momentum_now = get_value (momentum_value, nil)
local momentum_previous = get_value (momentum_value [1], nil)
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)

local data_is_ready =
    get_value (close [ema_period], nil) ~= nil and
    ema_now ~= nil and
    ema_previous ~= nil and
    momentum_now ~= nil and
    momentum_previous ~= nil and
    close_now ~= nil and
    close_previous ~= nil

-- Events on this candle.
local momentum_up = data_is_ready and momentum_previous <= 0 and momentum_now > 0
local momentum_down = data_is_ready and momentum_previous >= 0 and momentum_now < 0
local price_over_ema = data_is_ready and close_previous <= ema_previous and close_now > ema_now
local price_under_ema = data_is_ready and close_previous >= ema_previous and close_now < ema_now

momentum_up_event = conditional (momentum_up)
momentum_down_event = conditional (momentum_down)
price_over_ema_event = conditional (price_over_ema)
price_under_ema_event = conditional (price_under_ema)

-- True when the event happened on this candle or one of the previous candles.
local function happened_recently (event_series)
    for age = 0, event_window - 1 do
        if get_value (event_series [age], false) then
            return true
        end
    end
    return false
end

-- Both events inside the window, and both conditions still true now. The setup
-- fires on the candle that completes the pair.
local completes_pair_up = momentum_up or price_over_ema
local completes_pair_down = momentum_down or price_under_ema

higher_setup = conditional (
    data_is_ready and completes_pair_up and
    close_now > ema_now and momentum_now > 0 and
    happened_recently (momentum_up_event) and happened_recently (price_over_ema_event)
)

lower_setup = conditional (
    data_is_ready and completes_pair_down and
    close_now < ema_now and momentum_now < 0 and
    happened_recently (momentum_down_event) and happened_recently (price_under_ema_event)
)

-- 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 ema_visible then
    plot (trend_ema, "EMA", ema_color, ema_width)
end

if signals_visible then
    plot_shape (
        confirmed_higher,
        "EMA MOM HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "EMA MOM 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 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.