【发布时间】: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