【问题标题】:RSI trail pinescriptRSI 跟踪 pinescript
【发布时间】:2020-10-10 19:25:10
【问题描述】:

我在 RSI pinescript= 中需要帮助让我们假设“X”的价格是 6000 美元,它上升到 7000 美元并且 RSI 也超过了 band70。现在我希望警报在跌至 6980 美元时被激活(即回落 20 美元)。我如何在 RSI pinescript 中编写这个 TRAIL 脚本。

 //@version=4
study("rsi overbought", overlay=true)

rsiSource = input(title="RSI Source", type=input.source, defval=close)
rsiLength = input(title="RSI Length", type=input.integer, defval=14)
rsiOverbought = input(title="RSI Overbought Level", type=input.integer, defval=70)


rsiValue = rsi(rsiSource, rsiLength)
isRsiOB = rsiValue >= rsiOverbought


plotshape(isRsiOB, title="Overbought", location=location.abovebar, color=color.red, transp=0, style=shape.triangledown, text="Sell")

alertcondition(isRsiOB , title="RSI Signal!", message="RSI Signal Detected for {{ticker}}")  
       

【问题讨论】:

  • 使用 valuewhen(crossover(rsi,70),0) 创建一个变量。然后给出关闭 > 该变量 -20 的条件以给出信号,该信号可以在图表上绘制为形状。

标签: pine-script algorithmic-trading


【解决方案1】:

试试类似的东西

trail_high = highest(high,20) //highest high of 20 bars

down_num = 20 //the trailing 20$

if( low < trail_high - down_num)
    alert_code 

PS 这将在蜡烛关闭后触发

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 2011-05-08
    • 2015-04-09
    相关资源
    最近更新 更多