- Trend
- On price
- Intermediate
Marks closes that cross Kaufman's Adaptive Moving Average in the direction the average is already sloping. The slope check removes crosses where the flat, slow-moving KAMA is merely being touched by price.
The rules
HIGHER marker
The close crosses above KAMA(10, 2, 30) and KAMA is higher than on the previous candle.
LOWER marker
The close crosses below KAMA(10, 2, 30) and KAMA is lower than 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 blue line is the KAMA: it hugs price when the market trends and flattens when price is choppy. A green HIGHER triangle under a candle marks a close that crossed above a rising KAMA; a red LOWER triangle above a candle marks a close that crossed below a falling KAMA.
Indicators used
- KAMA (10, 2, 30)
Same view with built-in indicators: Add Kaufman Adaptive Moving Average from the IQ Option indicator list with period 10, fast 2, slow 30.
Default settings
| Efficiency period | 10 |
|---|---|
| Fast period | 2 |
| Slow period | 30 |
Every value is an input in the script settings. Platform advice is off by default.
Key points
- KAMA is a moving average that adapts: it speeds up in clean trends and slows down in noise.
- The settings are Perry Kaufman's own: 10, 2 and 30.
- A HIGHER marker needs two things: the close crosses above KAMA, and KAMA is rising.
- A LOWER marker is the mirror: the close crosses below a falling KAMA.
- A flat KAMA is a warning sign of a sideways market, and the slope check ignores those crosses.
- Test it on a Practice balance on different timeframes.
Limitations. KAMA flattens in noisy markets, so price can cross it repeatedly with little follow-through, and the slope filter only removes some of those crosses. The settings follow Perry Kaufman's recommended 10, 2 and 30, which is not the default of the built-in IQ Option indicator. 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: cd7f7b06cc524a6b3ad246523c62475500059e19f9da53b73b78eec6da361f24
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW KAMA Trend v1.0.0
--
-- Kaufman's Adaptive Moving Average (KAMA) speeds up when price moves in a
-- clear direction and slows down in noise. A close crossing the KAMA while
-- the KAMA itself slopes the same way marks a possible change of direction.
-- KAMA uses the same formula as the official IQ Option indicator.
--
-- HIGHER: the close crosses above KAMA(10, 2, 30) while KAMA is rising.
-- LOWER: the close crosses below KAMA(10, 2, 30) while KAMA is falling.
--
-- 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 KAMA Trend",
short_name = "IQOW KAMA",
overlay = true
}
input_group {
"1. KAMA settings",
kama_period = input (10, "Efficiency period", input.integer, 2, 200),
fast_period = input (2, "Fast period", input.integer, 1, 100),
slow_period = input (30, "Slow period", input.integer, 2, 250)
}
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",
kama_color = input { default = "#57A1D0", type = input.color },
line_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 }
}
-- Efficiency ratio: net move divided by the sum of single-bar moves. The net
-- move spans period - 1 bars, exactly as in the official Quadcode KAMA, so the
-- line matches the native indicator.
net_change = abs (close - close [kama_period - 1])
path_length = sum (abs (close - close [1]), kama_period)
efficiency_ratio = net_change / max (path_length, 1e-10)
-- Smoothing constant blends the fast and slow EMA constants, then is squared.
local fast_constant = 2 / (fast_period + 1)
local slow_constant = 2 / (slow_period + 1)
smoothing = (efficiency_ratio * (fast_constant - slow_constant) + slow_constant) ^ 2
kama_line = smoothing * close + (1 - smoothing) * nz (kama_line [1], close)
-- Current-bar scalars for the Lua rule logic.
local close_now = get_value (close, nil)
local close_before = get_value (close [1], nil)
local kama_now = get_value (kama_line, nil)
local kama_before = get_value (kama_line [1], nil)
local periods_are_valid = fast_period < slow_period
local data_is_ready =
periods_are_valid and
close_now ~= nil and
close_before ~= nil and
kama_now ~= nil and
kama_before ~= nil and
get_value (net_change, nil) ~= nil and
get_value (path_length, nil) ~= nil
-- Event: close crosses the KAMA on this candle while KAMA slopes the same way.
higher_setup = conditional (
data_is_ready and close_before <= kama_before and close_now > kama_now and kama_now > kama_before
)
lower_setup = conditional (
data_is_ready and close_before >= kama_before and close_now < kama_now and kama_now < kama_before
)
-- 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
plot (kama_line, "KAMA", kama_color, line_width)
end
if signals_visible then
plot_shape (
confirmed_higher,
"KAMA HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"KAMA 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
- 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)
- Trend
- Own panel
- Intermediate
Trend Intensity Index
Marks the moment the Trend Intensity Index enters its strong zone: above 80 for upward pressure or below 20 for downward pressure, with the close on the matching side of the 60-period SMA. It is a trend-strength entry marker, not a reversal marker.
Indicators: Trend Intensity Index (30, SMA 60)
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.