【问题标题】:True Strength Indicator Stretegy真实强度指标策略
【发布时间】:2020-01-17 10:34:42
【问题描述】:

我对编码世界很陌生,我正在尝试在 Tradingview 中构建一个简单的策略。

我只想建立一个基于真实强度指标的买卖策略。因此,每当“慢”线向上穿过信号线时,我想买入,而当慢线向下穿过信号线时,我想卖出。

谁能提供我的代码? 我有 TSI 指标的代码,仅用于显示指标但不用于交易信号。

非常感谢。

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    创建一个新的 Pinscript。选择真实强度指标 稍加修改,脚本将如下所示:

    //@version=4
    study("True Strength Indicator", shorttitle="TSI", format=format.price, precision=4)
    long = input(title="Long Length", type=input.integer, defval=25)
    short = input(title="Short Length", type=input.integer, defval=13)
    signal = input(title="Signal Length", type=input.integer, defval=13)
    price = close
    double_smooth(src, long, short) =>
        fist_smooth = ema(src, long)
        ema(fist_smooth, short)
    pc = change(price)
    double_smoothed_pc = double_smooth(pc, long, short)
    double_smoothed_abs_pc = double_smooth(abs(pc), long, short)
    tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)
    tsi_ema = ema(tsi_value, signal)
    plot(tsi_ema, color=#FF006E)
    plot(tsi_value, color=#3BB3E4)
    hline(0, title="Zero")
    

    现在创建您自己的表达式,使用变量 tsi_valuetsi_ema

    试试 whit crossunder 或交叉

    【讨论】:

      猜你喜欢
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多