MACD PSAR 7-14-5 Script

← All 56 scripts

  • Momentum
  • On price
  • Beginner

Marks the candle on which the fast MACD line crosses the zero line while the Parabolic SAR sits on the matching side of price. The MACD cross shows momentum changing side and the SAR dot shows which side the trailing stop is on.

  • File iqow-macd-psar-7-14-5.lua
  • Version 1.0.0
  • Size 135 lines · 5 KB
  • Timeframes 1-minute candles (the article holds a position for about 5 minutes)
  • License MIT
MACD PSAR 7-14-5 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 MACD(7, 14) line closes above zero after the previous candle was at or below zero, and the Parabolic SAR dot (0.02, 0.2) is below the close.

LOWER marker

The MACD(7, 14) line closes below zero after the previous candle was at or above zero, and the Parabolic SAR dot is above the close.

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 dots are the Parabolic SAR: dots under the candles mean the SAR is below price, dots above mean it is above. The MACD is not drawn on the price chart; a green HIGHER triangle under a candle means the MACD line just crossed above zero with SAR dots below price, and a red LOWER triangle above a candle is the mirror case.

Indicators used

  • MACD (7, 14, 5)
  • Parabolic SAR (0.02, 0.2)

Same view with built-in indicators: Add IQ Option's MACD with fast 7, slow 14, signal 5 and Parabolic SAR with default settings (0.02, 0.2).

Default settings

MACD fast7
MACD slow14
MACD signal (not used by the rule)5
SAR start0.02
SAR step0.02
SAR maximum0.2

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

Key points

  1. This setup uses only two tools: a fast MACD set to 7, 14 and 5, and the Parabolic SAR with default settings.
  2. The MACD line crossing the zero line tells us momentum has changed side.
  3. The Parabolic SAR must agree: dots below price for a HIGHER mark, dots above price for a LOWER mark.
  4. Both conditions must be true on the same completed candle, then the marker is drawn on that candle.
  5. Markers never repaint a forming candle, because they are confirmed one candle later.
  6. Try it on a Practice balance and watch how often it marks in a sideways market compared with a trend.

Limitations. The MACD zero line is crossed often in sideways markets, so many marks can appear without a lasting move. The SAR and a fast MACD both lag, so the mark comes after the first part of a move. 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: 4b999a8c37c4b708c0b854040a4a128fa01c03e433f9cc36efd0ba9729edeea1

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW MACD PSAR 7-14-5 v1.0.0
--
-- Combines a fast MACD (7, 14) with the Parabolic SAR. The MACD line crossing
-- the zero line shows momentum changing side; the SAR confirms which side of
-- price the trend stop is on. The MACD signal line (5) is not part of the rule,
-- so only the MACD line is calculated here. Add IQ Option's MACD (7, 14, 5)
-- below the chart if you want to see the zero-line cross itself.
--
-- HIGHER: the MACD line closes above zero after the previous candle was at or
--         below zero, and the Parabolic SAR dot is below the close.
-- LOWER:  the MACD line closes below zero after the previous candle was at or
--         above zero, and the Parabolic SAR dot is above the close.
--
-- 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 MACD PSAR 7-14-5",
    short_name = "IQOW MACD PSAR",
    overlay = true
}

input_group {
    "1. MACD line",
    macd_fast_period = input (7, "Fast EMA period", input.integer, 2, 100),
    macd_slow_period = input (14, "Slow EMA period", input.integer, 3, 200)
}

input_group {
    "2. Parabolic SAR",
    sar_start = input (0.02, "Start", input.double, 0.01, 1, 0.01),
    sar_step = input (0.02, "Step", input.double, 0.01, 1, 0.01),
    sar_maximum = input (0.2, "Maximum", input.double, 0.01, 1, 0.01)
}

input_group {
    "Display and advice",
    sar_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",
    sar_color = input { default = "#56CEFF", type = input.color },
    sar_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 }
}

-- MACD line = fast EMA minus slow EMA (same as the official MACD indicator).
macd_line = ema (close, macd_fast_period) - ema (close, macd_slow_period)
psar = sar (sar_start, sar_step, sar_maximum)

local macd_now = get_value (macd_line, nil)
local macd_previous = get_value (macd_line [1], nil)
local sar_now = get_value (psar, nil)
local close_now = get_value (close, nil)

local periods_are_valid = macd_fast_period < macd_slow_period

-- Wait until the slow EMA has some history behind it.
local data_is_ready =
    periods_are_valid and
    get_value (close [macd_slow_period], nil) ~= nil and
    macd_now ~= nil and
    macd_previous ~= nil and
    sar_now ~= nil and
    close_now ~= nil

-- Event: the MACD line crosses the zero line on this candle.
local macd_crosses_up = data_is_ready and macd_previous <= 0 and macd_now > 0
local macd_crosses_down = data_is_ready and macd_previous >= 0 and macd_now < 0

higher_setup = conditional (macd_crosses_up and sar_now < close_now)
lower_setup = conditional (macd_crosses_down and sar_now > close_now)

-- 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 sar_visible then
    plot (psar, "Parabolic SAR", sar_color, sar_width, 0, style.points)
end

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

    plot_shape (
        confirmed_lower,
        "MACD PSAR 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
  • Beginner

Ultimate Oscillator Cross

Marks the Ultimate Oscillator leaving its oversold or overbought zone. The oscillator blends three periods, so it reacts more evenly than a single-period oscillator.

Indicators: Ultimate Oscillator (7, 14, 28)

  • 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 %

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.