iqow-heikin-ashi-ema.lua 5 KB · 免费,MIT 许可证
如报名参加 IQ Option 网络交易室。Quadcode 在移动设备上不会绘制“更高”和“更低”标记。
将其添加到 IQ Option 在3步骤中
- 获取文件。 点击“获取脚本”。浏览器会保存一个 .lua 文件。
- 导入 IQ Option. 在模拟账户中打开网页交易室。点击图表左下角的波浪图标,打开“脚本”选项卡,点击“导入脚本”并选择文件。
- 将其添加到图表中。 代码会在编辑器中打开。点击代码下方的加号按钮(添加到图表)。只有在编辑完代码后才需要保存。
风险。 交易可能亏损。标记是基于图表观察得出的结论,并非预测,且此脚本已在测试数据上验证,未经实盘交易验证。请先在模拟账户上进行测试。
- 趋势
- 关于价格
- 初学者
仅当价格收于 50 日均线 (EMA 50) 的对应侧时,才会在连续出现两根方向相反的蜡烛图后,标记出第一根看涨或看跌的 Heikin-Ashi 蜡烛图。Heikin-Ashi 是在脚本内部计算的,因此图表可以保持常规蜡烛图。
观看:安装并跟随练习交易。
规则
更高标记
在连续出现两根看跌的 Heikin-Ashi 蜡烛图后,Heikin-Ashi 蜡烛图的收盘价高于开盘价,而实际收盘价高于 EMA 50。
下限标记
在连续出现两根看涨的 Heikin-Ashi 蜡烛图后,Heikin-Ashi 蜡烛图的收盘价低于开盘价,而实际收盘价低于 EMA 50。
下一个K线开盘后,会在完成该形态的K线上绘制一个标记。这只是一个图表观察结果,并非交易指令。
如何阅读它
琥珀色线是 50 日均线 (EMA)。当 Heikin-Ashi 指标颜色由阳转阳,位于 EMA 上方时,蜡烛图下方会出现一个绿色“上升”三角形;当 Heikin-Ashi 指标颜色由阳转阴,位于 EMA 下方时,蜡烛图上方会出现一个红色“下降”三角形。在显示设置中启用“Heikin-Ashi 蜡烛图”即可查看计算出的蜡烛图。
使用的指标
- Heikin-Ashi蜡烛图(计算值)
- EMA(50)
视图相同,但带有内置指示器: 将图表类型切换为 Heikin Ashi,并添加指数移动平均线(50)。
默认设置
| EMA周期 | 50 |
|---|---|
| 转弯前的跑动距离 | 2 |
| 展示 Heikin-Ashi 蜡烛 | 折扣 |
每个值都是脚本设置中的一个输入项。平台提示默认关闭。
关键点
- Heikin-Ashi 蜡烛图可以平均价格,因此一系列相同颜色的蜡烛图可以清晰地显示当前的上涨趋势。
- 我们等待连续出现两根看跌的 Heikin-Ashi 蜡烛图,然后再等待第一根看涨的 Heikin-Ashi 蜡烛图。
- EMA 50 起到过滤器的作用:对于更高的标记,实际收盘价必须高于它。
- 下限标记是镜像:两根阳线,一个阴线转折,收盘价低于 50 日均线。
- 该脚本会自动计算 Heikin-Ashi,因此您可以在图表上保留普通蜡烛图。
- 在模拟账户上进行测试,并注意其在波动市场中的表现。
局限性。 Heikin-Ashi 平滑处理滞后于实际价格,因此颜色变化往往在价格走势开始后才显现。在震荡行情中,颜色会迅速反转,EMA 过滤器无法完全消除这种现象。本文使用内置的 Heikin-Ashi 图表类型;此脚本默认添加了 EMA 50 过滤器和两根 K 线运行。在投入真实资金之前,请先在模拟账户中进行测试。
完整的源代码
下载的文件和预览文件指向的是同一个已审核的文件。SHA-256:1e911d19e9501d098fb00a9463472ae7aca03d8519bd021123ccd8018782a3b1
-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Heikin Ashi EMA v1.0.0
--
-- Heikin-Ashi candles smooth price into runs of same-colour candles. A turn
-- from a bearish run to a bullish candle, taken only on the correct side of
-- EMA 50, marks a possible shift back to the longer-term direction.
-- The Heikin-Ashi values are calculated here; your chart can stay on normal
-- candles. Optional Heikin-Ashi candles can be drawn from the display inputs.
--
-- HIGHER: a Heikin-Ashi candle turns bullish (HA close above HA open) after two
-- bearish Heikin-Ashi candles, and the real close is above EMA 50.
-- LOWER: a Heikin-Ashi candle turns bearish after two bullish Heikin-Ashi
-- candles, and the real close is 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 Heikin Ashi EMA",
short_name = "IQOW HA EMA",
overlay = true
}
input_group {
"1. Trend filter",
ema_period = input (50, "EMA period", input.integer, 2, 300),
bearish_run = input (2, "Candles in the run before the turn", input.integer, 1, 5)
}
input_group {
"Display and advice",
lines_visible = input { default = true, type = input.plot_visibility },
ha_candles_visible = input { default = false, 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 = "#FFB020", type = input.color },
ha_up_color = input { default = "#25E154", type = input.color },
ha_down_color = input { default = "#FF6C58", type = input.color },
line_width = input { default = 1, 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 }
}
-- Heikin-Ashi candle: averaged close, open from the previous HA candle.
ha_close = ohlc4
ha_open = iff (na (ha_open [1]), (open + close) / 2, (ha_open [1] + ha_close [1]) / 2)
ha_high = max (high, ha_open, ha_close)
ha_low = min (low, ha_open, ha_close)
ema_filter = ema (close, ema_period)
-- Current-bar scalars for the Lua rule logic.
local ha_close_now = get_value (ha_close, nil)
local ha_open_now = get_value (ha_open, nil)
local close_now = get_value (close, nil)
local ema_now = get_value (ema_filter, nil)
local data_is_ready =
ha_close_now ~= nil and
ha_open_now ~= nil and
close_now ~= nil and
get_value (ema_filter [ema_period], nil) ~= nil and
get_value (ha_open [bearish_run], nil) ~= nil
-- Count how many Heikin-Ashi candles in a row were bearish / bullish
-- immediately before the current candle.
local bearish_before = true
local bullish_before = true
if data_is_ready then
for back = 1, bearish_run do
if get_value (ha_close [back], 0) >= get_value (ha_open [back], 0) then
bearish_before = false
end
if get_value (ha_close [back], 0) <= get_value (ha_open [back], 0) then
bullish_before = false
end
end
end
-- Event: the Heikin-Ashi colour turns on this candle.
higher_setup = conditional (
data_is_ready and ha_close_now > ha_open_now and bearish_before and close_now > ema_now
)
lower_setup = conditional (
data_is_ready and ha_close_now < ha_open_now and bullish_before and close_now < ema_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 lines_visible then
plot (ema_filter, "EMA filter", ema_color, line_width)
end
-- Optional Heikin-Ashi candles drawn over the price candles.
if ha_candles_visible then
local ha_candle_color = ha_close_now ~= nil and ha_open_now ~= nil and ha_close_now >= ha_open_now
and ha_up_color or ha_down_color
plot_candle (ha_open, ha_high, ha_low, ha_close, "Heikin-Ashi", ha_candle_color)
end
if signals_visible then
plot_shape (
confirmed_higher,
"HA EMA HIGHER",
shape_style.triangleup,
shape_size.small,
higher_color,
shape_location.belowbar,
-1,
"HIGHER",
signal_text_color
)
plot_shape (
confirmed_lower,
"HA 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
更多趋势脚本
- 趋势
- 关于价格
- 初学者
定义明确的EMA
当20日均线穿过50日均线后,标志着价格首次回调至20日均线附近,并收于新趋势方向。这使得文章中提到的两个步骤(上穿和回调)合并为一个标记。
指标: EMA(20)· EMA(50)
- 趋势
- 关于价格
- 初学者
威廉姆斯R EMA回调
威廉指标%R交叉点标志着价格从超卖或超买区域回落,但前提是价格位于50日均线的相应一侧。该均线将文章中简单的%R交叉点转化为趋势回调形态。
指标: 威廉姆斯 %R (14, -80/-20) · EMA (50)
- 趋势
- 上下文指示器
- 关于价格
- 初学者
EMA趋势带
绘制价格的快速和慢速指数移动平均线,并用中性带状区域填充它们之间的空间,使两种平滑速度之间的关系更容易看清。
指标: EMA 9 · EMA 21
下载全部 74 个脚本,打包成一个 ZIP 文件 · 本软件采用 MIT 许可证,按“原样”提供,不提供任何担保。IQOptionWiki 独立于…… IQ Option 平台运营商。本平台内容不构成投资建议或收益保证。