KAMA趋势脚本

← 全部 74 个剧本

iqow-kama-trend.lua 5 KB · 免费,MIT 许可证

如报名参加 IQ Option 网络交易室。Quadcode 在移动设备上不会绘制“更高”和“更低”标记。

将其添加到 IQ Option 在3步骤中

  1. 获取文件。 点击“获取脚本”。浏览器会保存一个 .lua 文件。
  2. 导入 IQ Option. 在模拟账户中打开网页交易室。点击图表左下角的波浪图标,打开“脚本”选项卡,点击“导入脚本”并选择文件。
  3. 将其添加到图表中。 代码会在编辑器中打开。点击代码下方的加号按钮(添加到图表)。只有在编辑完代码后才需要保存。

风险。 交易可能亏损。标记是基于图表观察得出的结论,并非预测,且此脚本已在测试数据上验证,未经实盘交易验证。请先在模拟账户上进行测试。

  • 趋势
  • 关于价格
  • 中级

标记收盘价与考夫曼自适应移动平均线(KAMA)的交叉点,且交叉方向与KAMA的倾斜方向一致。斜率检查会剔除价格仅触及平坦、缓慢移动的KAMA的交叉点。

  • 文件 iqow-kama-trend.lua
  • 版本 1.0.0
  • 尺寸 138 行 · 5 KB
  • 时限 燃烧时间1分钟至15分钟的蜡烛
  • 执照 麻省理工学院简介

观看:安装并跟随练习交易。

KAMA趋势图基于合成蜡烛图绘制
脚本的绘制方式,以测试生成的合成蜡烛图为例进行说明。这只是标记和线条的示意图,并非真实市场数据或结果。

规则

更高标记

收盘价向上突破 KAMA(10, 2, 30),且 KAMA 值高于前一根蜡烛图。

下限标记

收盘价跌破 KAMA(10, 2, 30),且 KAMA 值低于前一根蜡烛图。

下一个K线开盘后,会在完成该形态的K线上绘制一个标记。这只是一个图表观察结果,并非交易指令。

如何阅读它

蓝线代表卡玛线:当市场趋势行情好转时,它紧贴价格走势;当市场震荡行情波动时,它趋于平缓。K线下方的绿色“上升”三角形表示收盘价突破了上升的卡玛线;K线上方的红色“下降”三角形表示收盘价跌破了下降的卡玛线。

使用的指标

  • 卡玛(10,2,30)

视图相同,但带有内置指示器: 添加考夫曼自适应移动平均线 IQ Option 周期为 10、快 2、慢 30 的指标列表。

默认设置

有效期10
禁食期2
慢速期30

每个值都是脚本设置中的一个输入项。平台提示默认关闭。

关键点

  1. KAMA 是一种会适应的移动平均线:在清晰的趋势中加速,在波动较大的情况中减速。
  2. 设置是 Perry Kaufman 自己的:10、2 和 30。
  3. 更高的指标需要两个条件:收盘价向上突破 KAMA 指数,并且 KAMA 指数正在上升。
  4. 较低的标记是镜像:接近的十字线位于下降的 KAMA 下方。
  5. KAMA 指标平坦是市场横盘整理的警告信号,而斜率检查会忽略这些交叉点。
  6. 在模拟账户中,使用不同的时间框架进行测试。

局限性。 KAMA 指标在波动较大的市场中会趋于平缓,因此价格可能会反复穿越该指标而后续走势甚微,而斜率滤波器只能消除其中一部分穿越。设置遵循 Perry Kaufman 推荐的 10、2 和 30,但这并非内置指标的默认值。 IQ Option 指标。在投入真实资金之前,请先在模拟账户中进行测试。

学习策略: 在 IQOptionWiki 上阅读完整指南 →

完整的源代码

下载和预览指向的是同一个已审核的文件。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

更多趋势脚本

  • 趋势
  • 关于价格
  • 初学者
IQOW 评分47排名#2726 个可直接进入的交易窗口 · 测试了 1,601,607 笔交易

SMA 8 21 十字

标记8周期简单移动平均线与21周期均线交叉,且价格收盘价突破这两条均线的K线。这是经典的双均线交叉,价格也进行了简单的验证。

指标: 8日移动平均线 · 21日移动平均线

  • 趋势
  • 关于价格
  • 中级
IQOW 评分0排名#5526 个可直接进入的交易窗口 · 测试了 61,937 笔交易

超级趋势 EMA 200

只有当K线收盘价位于200周期EMA的同一侧时,Marks Supertrend方向才会发生翻转。EMA起到了简单的长期偏差过滤器作用,用于判断Supertrend方向是否翻转。

指标: 超级趋势 (10, 3) · EMA (200)

  • 趋势
  • 自有面板
  • 中级
IQOW 评分42排名#3026 个可直接进入的交易窗口 · 测试了 460,765 笔交易

趋势强度指数

该指标标志着趋势强度指数进入强势区域:高于 80 表示上涨压力,低于 20 表示下跌压力,收盘价位于 60 周期简单移动平均线 (SMA) 的相应一侧。这是一个趋势强度入场标志,而非反转标志。

指标: 趋势强度指数(30日均线,60日均线)

下载全部 74 个脚本,打包成一个 ZIP 文件 · 本软件采用 MIT 许可证,按“原样”提供,不提供任何担保。IQOptionWiki 独立于…… IQ Option 平台运营商。本平台内容不构成投资建议或收益保证。

一般风险警告

公司提供的金融产品具有高风险,可能导致您损失所有资金。 你永远不应该投资你不能承受损失的钱。
请注意,本文不提供任何投资建议。 所提供的有关过去事件或未来潜在发展的信息仅是一种意见,不能保证是真实的,包括所提供的示例。 我们相应地提醒读者。