iqow-adx-ema28-cross.lua 5 KB · 免费,MIT 许可证
如报名参加 IQ Option 网络交易室。Quadcode 在移动设备上不会绘制“更高”和“更低”标记。
将其添加到 IQ Option 在3步骤中
- 获取文件。 点击“获取脚本”。浏览器会保存一个 .lua 文件。
- 导入 IQ Option. 在模拟账户中打开网页交易室。点击图表左下角的波浪图标,打开“脚本”选项卡,点击“导入脚本”并选择文件。
- 将其添加到图表中。 代码会在编辑器中打开。点击代码下方的加号按钮(添加到图表)。只有在编辑完代码后才需要保存。
风险。 交易可能亏损。标记是基于图表观察得出的结论,并非预测,且此脚本已在测试数据上验证,未经实盘交易验证。请先在模拟账户上进行测试。
- 趋势
- 关于价格
- 中级
标记一根收盘价穿过 28 日均线(EMA 28)的蜡烛图,其方向与 +DI 或 -DI 指标已指示的方向一致。DI 线起到方向过滤器的作用,EMA 交叉点则作为触发点。
规则
更高标记
+DI(5) 高于 -DI(5),且前一根蜡烛收盘价位于 EMA 28 或低于 EMA 28 之后,一根阳线收盘价高于 EMA 28。
下限标记
-DI(5) 高于 +DI(5),且前一根蜡烛收盘价位于 EMA 28 或高于 EMA 28 之后,出现一根阴线收盘价低于 EMA 28。
下一个K线开盘后,会在完成该形态的K线上绘制一个标记。这只是一个图表观察结果,并非交易指令。
如何阅读它
价格图表上的蓝线是 28 日均线 (EMA 28)。K 线下方的绿色“上升”三角形表示一根阳线收盘价高于 EMA,且 +DI 指标领先;K 线上方的红色“下降”三角形则表示相反的情况。DI 指标线未绘制在价格图表上,因此需要将周期为 5 的 ADX 指标添加到面板中才能看到它们。
使用的指标
- ADX +DI / -DI (5)
- EMA(28)
视图相同,但带有内置指示器: 添加 IQ Option面板中显示 ADX(DI 周期 5),价格图表中显示周期为 28 的指数移动平均线。
默认设置
| DI 时期 | 5 |
|---|---|
| EMA周期 | 28 |
每个值都是脚本设置中的一个输入项。平台提示默认关闭。
关键点
- 该设置使用了两个概念:ADX 方向线和周期为 28 的 EMA。
- +DI 高于 -DI 表示近期上涨行情强于下跌行情。
- 触发条件是前一根蜡烛收盘价在 EMA 或 EMA 下方,而后一根蜡烛收盘价在 EMA 上方,并且这根蜡烛本身必须是阳线。
- 如果 -DI 领先,且阴线收盘价低于 EMA,则脚本标记为 LOWER。
- 标记只会在蜡烛熄灭后出现,因此不会重新绘制。
- 在模拟账户上进行测试,看看当 ADX 较低时价格穿过 EMA 的频率。
局限性。 在市场平静或横盘整理时,价格经常反复穿越28周期指数移动平均线(EMA),每次穿越都可能在两条DI线接近时通过DI过滤器。是否使用EMA斜率或ADX水平作为额外参考信息取决于交易者。在投入真实资金之前,请先在模拟账户中进行测试。
完整的源代码
下载和预览指向的是同一个已审核的文件。SHA-256:97598a557633a611f918c97c6c7796c0d66f3d7466d7d7e66b90f61af43435c0
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW ADX EMA28 Cross v1.0.0
--
-- Combines the directional indicators of ADX (+DI and -DI, period 5) with an
-- EMA 28 on price. +DI above -DI says buyers dominate the recent moves; a
-- candle closing through the EMA gives the timing. DI follows the official
-- ADX/DMS script of the Quadcode library.
--
-- HIGHER: +DI(5) is above -DI(5) and a bullish candle closes above EMA 28
-- after the previous close was at or below it.
-- LOWER: -DI(5) is above +DI(5) and a bearish candle closes below EMA 28
-- after the previous close was at or above it.
--
-- 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 ADX EMA28 Cross",
short_name = "IQOW ADX EMA",
overlay = true
}
input_group {
"1. ADX directional indicators",
di_period = input (5, "DI period", input.integer, 2, 100)
}
input_group {
"2. Moving average",
ema_period = input (28, "EMA period", input.integer, 2, 300)
}
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 = "#56CEFF", 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 }
}
-- Directional movement and DI, as in the official ADX/DMS script.
up_move = change (high)
down_move = -change (low)
plus_dm = iff (up_move > down_move and nz (up_move) > 0, up_move, 0)
minus_dm = iff (down_move > up_move and nz (down_move) > 0, down_move, 0)
average_range = max (rma (tr, di_period), 1e-10)
plus_di = 100 * rma (plus_dm / average_range, di_period)
minus_di = 100 * rma (minus_dm / average_range, di_period)
ema_line = ema (close, ema_period)
-- Current-bar scalars for the Lua rule logic.
local plus_now = get_value (plus_di, nil)
local minus_now = get_value (minus_di, nil)
local ema_now = get_value (ema_line, nil)
local ema_previous = get_value (ema_line [1], nil)
local close_now = get_value (close, nil)
local close_previous = get_value (close [1], nil)
local open_now = get_value (open, nil)
-- Wait until the EMA has a full period of history behind it.
local has_history = get_value (close [ema_period], nil) ~= nil
local data_is_ready =
has_history and
plus_now ~= nil and
minus_now ~= nil and
ema_now ~= nil and
ema_previous ~= nil and
close_now ~= nil and
close_previous ~= nil and
open_now ~= nil
-- Event: a bullish candle closes above the EMA after a close at or below it.
higher_setup = conditional (
data_is_ready and
plus_now > minus_now and
close_previous <= ema_previous and
close_now > ema_now and
close_now > open_now
)
-- Mirror: a bearish candle closes below the EMA after a close at or above it.
lower_setup = conditional (
data_is_ready and
minus_now > plus_now and
close_previous >= ema_previous and
close_now < ema_now and
close_now < open_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 (ema_line, "EMA", ema_color, ema_width)
end
if signals_visible then
plot_shape (
confirmed_higher,
"ADX EMA HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"ADX 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
更多趋势脚本
- 趋势
- 关于价格
- 中级
RSI 随机指标 EMA200
以200日均线(EMA 200)作为趋势过滤器,50日相对强弱指标(RSI 50)作为动量过滤器,并以随机指标突破其极端区域作为时机判断。它标志着沿大趋势方向的回调结束。
指标: EMA(200)· RSI(14)· 随机指标(14, 3, 3)
- 趋势
- 关于价格
- 初学者
SMA 8 21 十字
标记8周期简单移动平均线与21周期均线交叉,且价格收盘价突破这两条均线的K线。这是经典的双均线交叉,价格也进行了简单的验证。
指标: 8日移动平均线 · 21日移动平均线
- 趋势
- 关于价格
- 中级
超级趋势 EMA 200
只有当K线收盘价位于200周期EMA的同一侧时,Marks Supertrend方向才会发生翻转。EMA起到了简单的长期偏差过滤器作用,用于判断Supertrend方向是否翻转。
指标: 超级趋势 (10, 3) · EMA (200)
下载全部 74 个脚本,打包成一个 ZIP 文件 · 本软件采用 MIT 许可证,按“原样”提供,不提供任何担保。IQOptionWiki 独立于…… IQ Option 平台运营商。本平台内容不构成投资建议或收益保证。