- Trend
- On price
- Intermediate
Marks a MACD signal-line cross that is backed by candle colour, the EMA and the Parabolic SAR. Three different views of price have to agree on the same completed candle.
The rules
HIGHER marker
The MACD(12, 26, 9) line crosses above its signal line on a bullish candle that closes above the EMA(10), with the Parabolic SAR below the close.
LOWER marker
The MACD line crosses below its signal line on a bearish candle that closes below the EMA(10), with the Parabolic SAR 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 yellow line is the EMA and the dots are the Parabolic SAR. A green HIGHER triangle under a candle means MACD just crossed up on a bullish candle above the EMA with SAR dots below price; a red LOWER triangle above a candle is the mirror case. The MACD itself is not drawn on the price chart.
Indicators used
- MACD (12, 26, 9)
- Parabolic SAR (0.02, 0.2)
- EMA (10)
Same view with built-in indicators: Add IQ Option's MACD (12, 26, 9), Parabolic SAR (default) and a Moving Average of type EMA with period 10.
Default settings
| MACD fast | 12 |
|---|---|
| MACD slow | 26 |
| MACD signal | 9 |
| SAR start | 0.02 |
| SAR step | 0.02 |
| SAR maximum | 0.2 |
| EMA period | 10 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- This setup stacks three indicators: MACD, the Parabolic SAR and an EMA.
- First the MACD line has to cross its signal line on the completed candle.
- That candle must be bullish and close above the EMA for HIGHER, or bearish and close below it for LOWER.
- The Parabolic SAR dot must sit under price for HIGHER and above price for LOWER.
- Because many conditions must agree, marks are less frequent than with a single indicator.
- Practise on a Practice balance, ideally on a 5-minute chart.
Limitations. The article describes the EMA and SAR as flipping around the entry candle; the script checks their position (EMA below price, SAR on the matching side) instead of detecting a fresh flip, and uses the EMA(10) from the article rather than a longer trend average. With three conditions, marks are rare and can still appear in choppy markets. Test on the Practice balance before risking real funds.
Install it in four steps
- 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.
- Open Chart Analysis → ScriptsIn the IQ Option traderoom, choose the Practice balance, open the chart analysis panel, select Scripts and choose Import script.
- Save and add to chartSelect the downloaded file, review the imported code, choose Save, then use the + control to add it to the chart.
- 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: 43d5e645dee79c5f0450ceab521d170aaad45240f5169c12ba5c5dfae0fd1c69
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW MACD PSAR EMA v1.0.0
--
-- Combines MACD (12, 26, 9), the Parabolic SAR and a short EMA, as in the
-- related article. A MACD signal-line cross shows momentum turning, the candle
-- colour and EMA position show price agrees, and the SAR shows the trailing stop
-- is on the matching side of price.
--
-- HIGHER: the MACD line crosses above its signal line on a bullish candle that
-- closes above the EMA, with the Parabolic SAR below the close.
-- LOWER: the MACD line crosses below its signal line on a bearish candle that
-- closes below the EMA, with the Parabolic SAR 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 EMA",
short_name = "IQOW MACD EMA",
overlay = true
}
input_group {
"1. MACD",
macd_fast_period = input (12, "Fast EMA period", input.integer, 2, 100),
macd_slow_period = input (26, "Slow EMA period", input.integer, 3, 200),
macd_signal_period = input (9, "Signal period", input.integer, 2, 100)
}
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 {
"3. EMA",
ema_period = input (10, "EMA period", input.integer, 2, 300)
}
input_group {
"Display and advice",
ema_visible = input { default = true, type = input.plot_visibility },
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",
ema_color = input { default = "#FFD166", type = input.color },
ema_width = input { default = 2, type = input.line_width },
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 and signal line (same as the official MACD indicator).
macd_line = ema (close, macd_fast_period) - ema (close, macd_slow_period)
signal_line = ema (macd_line, macd_signal_period)
trend_ema = ema (close, ema_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 signal_now = get_value (signal_line, nil)
local signal_previous = get_value (signal_line [1], nil)
local ema_now = get_value (trend_ema, nil)
local sar_now = get_value (psar, nil)
local close_now = get_value (close, nil)
local open_now = get_value (open, nil)
local periods_are_valid = macd_fast_period < macd_slow_period
local data_is_ready =
periods_are_valid and
get_value (close [macd_slow_period + macd_signal_period], nil) ~= nil and
macd_now ~= nil and
macd_previous ~= nil and
signal_now ~= nil and
signal_previous ~= nil and
ema_now ~= nil and
sar_now ~= nil and
close_now ~= nil and
open_now ~= nil
-- Event: the MACD line crosses its signal line on this candle.
local macd_crosses_up = data_is_ready and macd_previous <= signal_previous and macd_now > signal_now
local macd_crosses_down = data_is_ready and macd_previous >= signal_previous and macd_now < signal_now
higher_setup = conditional (
macd_crosses_up and
close_now > open_now and
close_now > ema_now and
sar_now < close_now
)
lower_setup = conditional (
macd_crosses_down and
close_now < open_now and
close_now < ema_now 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 ema_visible then
plot (trend_ema, "EMA", ema_color, ema_width)
end
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 EMA HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"MACD PSAR EMA 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 trend scripts
- Trend
- On price
- Intermediate
RSI Stochastic EMA200
Uses the EMA 200 as a trend filter, RSI 50 as a momentum filter and a Stochastic cross out of its extreme zone as the timing. It marks the end of a pullback in the direction of the larger trend.
Indicators: EMA (200) · RSI (14) · Stochastic (14, 3, 3)
- Trend
- On price
- Beginner
SMA 8 21 Cross
Marks the candle on which the 8-period simple moving average crosses the 21-period average and price closes beyond both lines. It is the classic two-average cross with a simple price check.
Indicators: SMA (8) · SMA (21)
- Trend
- On price
- Intermediate
Supertrend EMA 200
Marks Supertrend direction flips only when the candle closes on the same side of the 200-period EMA. The EMA acts as a simple long-term bias filter for the Supertrend flip.
Indicators: Supertrend (10, 3) · EMA (200)
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.