随机PSAR脚本

← 全部 74 个剧本

iqow-stochastic-psar.lua 5 KB · 免费,MIT 许可证

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

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

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

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

  • 翻转
  • 关于价格
  • 初学者

随机指标%K/%D交叉点位于超卖或超买区域,同时抛物线转向指标(Parabolic SAR)点位于价格的相应一侧。随机指标指示时机,而转向指标则检查追踪止损是否与此一致。

  • 文件 iqow-stochastic-psar.lua
  • 版本 1.0.1
  • 尺寸 153 行 · 5 KB
  • 时限 任何时间段
  • 执照 麻省理工学院简介
基于合成蜡烛图绘制的随机PSAR
脚本的绘制方式,以测试生成的合成蜡烛图为例进行说明。这只是标记和线条的示意图,并非真实市场数据或结果。

规则

更高标记

随机指标 %K 在前一根蜡烛图上处于 20 或以下,而抛物线转向指标点低于收盘价,此时 %K 向上穿过 %D。

下限标记

随机指标 %K 在前一根蜡烛图上达到或超过 80 后向下穿过 %D,并且抛物线转向指标点位于收盘价上方。

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

如何阅读它

这些点代表抛物线转向指标(Parabolic SAR)。蜡烛图下方的绿色高三角形表示随机指标刚刚从超卖区域向上突破,而转向指标点位于价格下方;蜡烛图上方的红色低三角形则表示相反的情况。随机指标并未绘制在价格图表上。

使用的指标

  • 随机指标(14,3,3)
  • 抛物线SAR(0.02,0.2)

视图相同,但带有内置指示器: 添加 IQ Option随机震荡指标(14、3、3,水平 80/20)和抛物线 SAR 指标(0.02、0.2)。

默认设置

随机 %K14
随机平滑3
随机 %D3
超卖20
超买80
SAR启动0.02
SAR步长0.02
SAR最大值0.2

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

关键点

  1. 随机指标有两条线,%K 和 %D,取值范围在 0 到 100 之间。
  2. 低于 20 为超卖,高于 80 为超买。
  3. 我们希望 %K 在停留在这些区域之一后越过 %D。
  4. 抛物线转向指标点必须支持方向:低于价格表示上涨,高于价格表示下跌。
  5. 两个信号必须出现在同一根已完成的蜡烛图上,标记则在下一根蜡烛图之后绘制。
  6. 在模拟天平上进行测试,并注意 SAR 计时如何改变分数。

局限性。 文章将随机指标交叉和转向指标(SAR)视为一种组合,但没有给出确切的超卖或超买规则,因此使用了20和80这两个数值。由于转向指标的点必须已经位于价格的另一侧,因此该标记可能会滞后出现,并且在强劲的趋势中,随机指标会在其区域内停留很长时间。随机指标的计算方法如下: IQ Option内置版本:以 %K 周期内的最高价和最低价为基准收盘。在投入真实资金之前,请先在模拟账户中进行测试。

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

完整的源代码

下载的文件和预览文件指向的是同一个已审核的文件。SHA-256:9e1fc0313703da65a906120625502510238a3c78495a11f3612f45d838befb0d

-- SPDX-License-Identifier: MIT
-- IQOptionWiki QCS Library
-- IQOW Stochastic PSAR v1.0.1
--
-- Combines the Stochastic oscillator (14, 3, 3) with the Parabolic SAR, as in
-- the related article. The Stochastic cross out of an extreme zone gives the
-- timing; the SAR confirms that its dots are on the matching side of price.
--
-- The Stochastic follows IQ Option's built-in Stochastic Oscillator: the close
-- against the highest high and the lowest low of the %K period. Version 1.0.1
-- (9 October 2026) changed this from the highest and lowest close; the inputs,
-- periods and levels are unchanged.
--
-- HIGHER: %K crosses above %D after %K was at or below 20 on the previous
--         candle, and the Parabolic SAR dot is below the close.
-- LOWER:  %K crosses below %D after %K was at or above 80 on the previous
--         candle, and the Parabolic SAR dot is 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 Stochastic PSAR",
    short_name = "IQOW STO PSAR",
    overlay = true
}

input_group {
    "1. 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 {
    "2. Stochastic",
    k_period = input (14, "%K period", input.integer, 2, 100),
    k_smoothing = input (3, "%K smoothing", input.integer, 1, 20),
    d_period = input (3, "%D period", input.integer, 1, 20),
    oversold_level = input (20, "Oversold level", input.double, 1, 45, 1, false),
    overbought_level = input (80, "Overbought level", input.double, 55, 99, 1, false)
}

input_group {
    "Display and advice",
    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",
    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 }
}

psar = sar (sar_start, sar_step, sar_maximum)

-- Stochastic as IQ Option's built-in oscillator draws it: the close against the
-- highest high and lowest low of the %K period (not the highest and lowest
-- close), 50 when that range is zero. %K is that value smoothed with an SMA and
-- multiplied by 100; %D is an SMA of %K.
stoch_low = lowest (low, k_period)
stoch_range = highest (high, k_period) - stoch_low
stoch_raw = iff (stoch_range > 0, (close - stoch_low) / stoch_range, stoch_range + 0.5)
stoch_k = sma (stoch_raw, k_smoothing) * 100
stoch_d = sma (stoch_k, d_period)

local sar_now = get_value (psar, nil)
local k_now = get_value (stoch_k, nil)
local d_now = get_value (stoch_d, nil)
local k_previous = get_value (stoch_k [1], nil)
local d_previous = get_value (stoch_d [1], nil)
local close_now = get_value (close, nil)

local levels_are_valid = oversold_level < 50 and overbought_level > 50

local data_is_ready =
    levels_are_valid and
    sar_now ~= nil and
    k_now ~= nil and
    d_now ~= nil and
    k_previous ~= nil and
    d_previous ~= nil and
    close_now ~= nil

-- Event: %K crosses %D on this candle, starting from the extreme zone.
local cross_up_from_oversold =
    data_is_ready and k_previous <= d_previous and k_now > d_now and k_previous <= oversold_level
local cross_down_from_overbought =
    data_is_ready and k_previous >= d_previous and k_now < d_now and k_previous >= overbought_level

higher_setup = conditional (cross_up_from_oversold and sar_now < close_now)
lower_setup = conditional (cross_down_from_overbought 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 sar_visible then
    plot (psar, "Parabolic SAR", sar_color, sar_width, 0, style.points)
end

if signals_visible then
    plot_shape (
        confirmed_higher,
        "STO PSAR HIGHER",
        shape_style.triangleup,
        shape_size.small,
        higher_color,
        shape_location.belowbar,
        -1,
        "HIGHER",
        signal_text_color
    )

    plot_shape (
        confirmed_lower,
        "STO PSAR 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 前十名76排名#1026 个可直接进入的交易窗口 · 测试了 2,436,963 笔交易

Donchian RSI 反转

当价格在同一波动中触及相应的唐奇安通道后,RSI 指标便会脱离超卖或超买区域。通道显示价格拉伸的程度;RSI 指标则显示动能何时开始转变。

指标: 唐奇安海峡 (20) · RSI (14, 30/70)

  • 翻转
  • 自有面板
  • 中级
IQOW 前十名78排名#926 个可直接进入的交易窗口 · 测试了 1,340,505 笔交易

双重随机

标记慢速随机指标确认反转交叉的K线,该反转交叉此前已在快速随机指标显示的超卖或超买区域出现。使用两种设置,会在标记出现之前,在两个不同的时间尺度上提出相同的问题。

指标: 随机快(8, 3, 5)· 随机慢(17, 3, 7)

  • 翻转
  • 关于价格
  • 初学者
IQOW 前十名86排名#426 个可直接进入的交易窗口 · 测试了 327,508 笔交易

信封 RSI

这标志着价格从包络线反弹:一根K线触及外线,收盘价又回到内线,RSI指标确认价格被拉高。这与相关文章中提到的“从两侧反弹”的方法一致。

指标: 移动平均线包络线(20周期简单移动平均线,标准差1)· RSI(14,35/65)

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

一般风险警告

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