iqow-well-defined-ema.lua 5 KB · 免费,MIT 许可证
如报名参加 IQ Option 网络交易室。Quadcode 在移动设备上不会绘制“更高”和“更低”标记。
将其添加到 IQ Option 在3步骤中
- 获取文件。 点击“获取脚本”。浏览器会保存一个 .lua 文件。
- 导入 IQ Option. 在模拟账户中打开网页交易室。点击图表左下角的波浪图标,打开“脚本”选项卡,点击“导入脚本”并选择文件。
- 将其添加到图表中。 代码会在编辑器中打开。点击代码下方的加号按钮(添加到图表)。只有在编辑完代码后才需要保存。
风险。 交易可能亏损。标记是基于图表观察得出的结论,并非预测,且此脚本已在测试数据上验证,未经实盘交易验证。请先在模拟账户上进行测试。
- 趋势
- 关于价格
- 初学者
当20日均线穿过50日均线后,标志着价格首次回调至20日均线附近,并收于新趋势方向。这使得文章中提到的两个步骤(上穿和回调)合并为一个标记。
观看:安装并跟随练习交易。
规则
更高标记
当 EMA(20) 上穿 EMA(50) 后,第一根触及 EMA(20) 且收盘价高于 EMA(20) 的蜡烛图被标记为“更高”。
下限标记
当 EMA(20) 向下穿过 EMA(50) 时,第一根触及 EMA(20) 且收盘价低于 EMA(20) 的蜡烛图被标记为“LOWER”。
下一个K线开盘后,会在完成该形态的K线上绘制一个标记。这只是一个图表观察结果,并非交易指令。
如何阅读它
黄线是 20 日均线,蓝线是 50 日均线。K 线下方的绿色高三角形表示价格在向上穿越黄线后回落至黄线附近,并在黄线上方收盘上涨;K 线上方的红色低三角形则表示下跌趋势中的相反情况。
使用的指标
- EMA(20)
- EMA(50)
视图相同,但带有内置指示器: 加两个 IQ Option 周期分别为 20 和 50 的 EMA 型移动平均线。
默认设置
| 快速EMA周期 | 20 |
|---|---|
| 慢速EMA周期 | 50 |
每个值都是脚本设置中的一个输入项。平台提示默认关闭。
关键点
- 在图表中添加两条 EMA 线:一条 20 周期 EMA 线和一条 50 周期 EMA 线。
- 第一步:20日均线穿过50日均线,这表明新的趋势方向。
- 第二步:我们等待价格回落到 EMA 20,而不是追涨杀跌。
- 当回调蜡烛触及该线并收于趋势方向时,标记就会出现。
- 仅标记每次过弯后的第一次合格回撤。
- 在模拟账户上进行测试,并在信任任何设置之前比较不同时间段的数据。
局限性。 每次交叉后,仅标记第一次符合条件的回调,因此长期趋势只标记一次。文章中使用的是简单的触线法;此脚本还要求K线收盘价与趋势方向一致。震荡市场经常会穿过EMA均线。在投入真实资金之前,请先在模拟账户中进行测试。
完整的源代码
下载和预览指向的是同一个已审核的文件。SHA-256:27657fb7eeab7e33e12d1fbd7b560041c8517532c469813755268cd033fea8b2
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Well Defined EMA v1.0.0
--
-- Two EMAs (20 and 50), as in the related article. After the fast EMA crosses
-- the slow EMA, the script waits for the first pullback of price to the fast EMA
-- and marks the candle that touches it and closes back in the trend direction.
--
-- HIGHER: after EMA 20 crossed above EMA 50, the first candle that touches EMA 20
-- with its low closes bullish above EMA 20 (EMA 20 still above EMA 50).
-- LOWER: after EMA 20 crossed below EMA 50, the first candle that touches EMA 20
-- with its high closes bearish below EMA 20 (EMA 20 still below EMA 50).
--
-- 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 Well Defined EMA",
short_name = "IQOW EMA PB",
overlay = true
}
input_group {
"1. Exponential moving averages",
fast_period = input (20, "Fast EMA period", input.integer, 2, 100),
slow_period = input (50, "Slow EMA period", input.integer, 3, 300)
}
input_group {
"Display and advice",
averages_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",
fast_color = input { default = "#FFD166", type = input.color },
slow_color = input { default = "#56CEFF", type = input.color },
average_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 }
}
fast_ema = ema (close, fast_period)
slow_ema = ema (close, slow_period)
local fast_now = get_value (fast_ema, nil)
local slow_now = get_value (slow_ema, nil)
local fast_previous = get_value (fast_ema [1], nil)
local slow_previous = get_value (slow_ema [1], nil)
local close_now = get_value (close, nil)
local open_now = get_value (open, nil)
local high_now = get_value (high, nil)
local low_now = get_value (low, nil)
local periods_are_valid = fast_period < slow_period
local data_is_ready =
periods_are_valid and
get_value (close [slow_period], nil) ~= nil and
fast_now ~= nil and
slow_now ~= nil and
fast_previous ~= nil and
slow_previous ~= nil and
close_now ~= nil and
open_now ~= nil and
high_now ~= nil and
low_now ~= nil
-- Event: the fast EMA crosses the slow EMA.
local crosses_up = data_is_ready and fast_previous <= slow_previous and fast_now > slow_now
local crosses_down = data_is_ready and fast_previous >= slow_previous and fast_now < slow_now
-- A candle touches the fast EMA when its range reaches the line.
local touches_fast = data_is_ready and low_now <= fast_now and high_now >= fast_now
-- "Armed" means a cross happened and no pullback marker has fired since.
local was_long_armed = get_value (long_armed [1], false)
local was_short_armed = get_value (short_armed [1], false)
-- Event: a pullback candle touches the fast EMA and closes in trend direction.
local pullback_up =
was_long_armed and touches_fast and
close_now > open_now and close_now > fast_now and fast_now > slow_now
local pullback_down =
was_short_armed and touches_fast and
close_now < open_now and close_now < fast_now and fast_now < slow_now
long_armed = conditional (
data_is_ready and fast_now > slow_now and
(crosses_up or (was_long_armed and not pullback_up))
)
short_armed = conditional (
data_is_ready and fast_now < slow_now and
(crosses_down or (was_short_armed and not pullback_down))
)
higher_setup = conditional (pullback_up)
lower_setup = conditional (pullback_down)
-- 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 averages_visible then
plot (fast_ema, "Fast EMA", fast_color, average_width)
plot (slow_ema, "Slow EMA", slow_color, average_width)
end
if signals_visible then
plot_shape (
confirmed_higher,
"EMA PB HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"EMA PB 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
更多趋势脚本
- 趋势
- 关于价格
- 先进的
分形鳄鱼
当最后一个已确认的分形水平位于鳄鱼齿状线之外时,即标志着收盘价突破了该分形水平。鳄鱼齿状线提供趋势参考,分形线提供突破水平。
指标: 威廉姆斯分形 (5) · 鳄鱼 (13/8/5,移位 8/5/3)
- 趋势
- 关于价格
- 初学者
平金足 EMA
仅当价格收于 50 日均线 (EMA 50) 的对应侧时,才会在连续出现两根方向相反的蜡烛图后,标记出第一根看涨或看跌的 Heikin-Ashi 蜡烛图。Heikin-Ashi 是在脚本内部计算的,因此图表可以保持常规蜡烛图。
指标: Heikin-Ashi蜡烛图(计算值)· EMA(50)
- 趋势
- 关于价格
- 先进的
一目棋纯云
当价格已经位于彩色一目均衡图云图的趋势侧时,基准线(Kijun-sen)的收盘价会再次穿过基准线。云图决定方向,基准线交叉决定时机。
指标: 一目均衡图(9, 26, 52, 位移 26)
下载全部 74 个脚本,打包成一个 ZIP 文件 · 本软件采用 MIT 许可证,按“原样”提供,不提供任何担保。IQOptionWiki 独立于…… IQ Option 平台运营商。本平台内容不构成投资建议或收益保证。