iqow-macd-psar-ema.lua 5 KB · 免费,MIT 许可证
如报名参加 IQ Option 网络交易室。Quadcode 在移动设备上不会绘制“更高”和“更低”标记。
将其添加到 IQ Option 在3步骤中
- 获取文件。 点击“获取脚本”。浏览器会保存一个 .lua 文件。
- 导入 IQ Option. 在模拟账户中打开网页交易室。点击图表左下角的波浪图标,打开“脚本”选项卡,点击“导入脚本”并选择文件。
- 将其添加到图表中。 代码会在编辑器中打开。点击代码下方的加号按钮(添加到图表)。只有在编辑完代码后才需要保存。
风险。 交易可能亏损。标记是基于图表观察得出的结论,并非预测,且此脚本已在测试数据上验证,未经实盘交易验证。请先在模拟账户上进行测试。
- 趋势
- 关于价格
- 中级
它标志着MACD信号线与K线颜色、EMA和抛物线转向指标(Parabolic SAR)的交叉。这三种不同的价格指标必须对同一根已完成的K线达成一致。
规则
更高标记
MACD(12, 26, 9) 线在阳线收盘价高于 EMA(10) 时向上穿过其信号线,而抛物线转向指标 (Parabolic SAR) 则在收盘价下方。
下限标记
MACD 线向下穿过其信号线,形成一根阴线,收盘价低于 EMA(10),而抛物线 SAR 指标高于收盘价。
下一个K线开盘后,会在完成该形态的K线上绘制一个标记。这只是一个图表观察结果,并非交易指令。
如何阅读它
黄线是指数移动平均线(EMA),点是抛物线转向指标(Parabolic SAR)。K线下方的绿色高三角形表示MACD指标刚刚在EMA上方的阳线K线上向上交叉,且SAR点位于价格下方;K线上方的红色低三角形则表示相反的情况。MACD指标本身并未绘制在价格图表上。
使用的指标
- MACD (12, 26, 9)
- 抛物线SAR(0.02,0.2)
- EMA(10)
视图相同,但带有内置指示器: 添加 IQ OptionMACD(12、26、9)、抛物线转向指标(默认)和周期为 10 的 EMA 类型移动平均线。
默认设置
| MACD快速指标 | 12 |
|---|---|
| MACD 慢速 | 26 |
| MACD信号 | 9 |
| SAR启动 | 0.02 |
| SAR步长 | 0.02 |
| SAR最大值 | 0.2 |
| EMA周期 | 10 |
每个值都是脚本设置中的一个输入项。平台提示默认关闭。
关键点
- 这种设置叠加了三个指标:MACD、抛物线转向指标和EMA。
- 首先,MACD线必须在已完成的K线中穿过其信号线。
- 该蜡烛图必须是阳线,收盘价高于 EMA 线表示上涨,或者必须是阴线,收盘价低于 EMA 线表示下跌。
- 抛物线转向指标点必须位于价格下方才能表示价格上涨,必须位于价格上方才能表示价格下跌。
- 由于许多条件必须同时满足,因此评分频率低于使用单一指标的情况。
- 在练习用平衡表上练习,最好是在 5 分钟图表上练习。
局限性。 文章中提到EMA和SAR指标会在入场K线附近翻转;脚本会检查它们的位置(EMA在价格下方,SAR在相应位置),而不是检测新的翻转,并且使用文章中提到的EMA(10)指标,而不是更长时间的趋势均线。在满足三个条件的情况下,标记很少出现,并且仍然可能在波动较大的市场中出现。在投入真实资金之前,请先在模拟账户中进行测试。
完整的源代码
下载的文件和预览文件指向的是同一个已审核的文件。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
更多趋势脚本
- 趋势
- 关于价格
- 中级
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 平台运营商。本平台内容不构成投资建议或收益保证。