Pine script RSI跟踪脚本

Pine script RSI跟踪脚本,pine-script,algorithmic-trading,Pine Script,Algorithmic Trading,我需要RSI pinescript的帮助=假设“X”的价格为6000美元,上升到7000美元,RSI也超过了70。现在,我希望警报在下降到$6980时激活(即以$20的价格恢复跟踪)。如何在RSI脚本中编写此跟踪脚本 //@version=4 study("rsi overbought", overlay=true) rsiSource = input(title="RSI Source", type=input.source, defval=clos

我需要RSI pinescript的帮助=假设“X”的价格为6000美元,上升到7000美元,RSI也超过了70。现在,我希望警报在下降到$6980时激活(即以$20的价格恢复跟踪)。如何在RSI脚本中编写此跟踪脚本

 //@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}}")  
       
试试像这样的东西

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

down_num = 20 //the trailing 20$

if( low < trail_high - down_num)
    alert_code 
trail\u high=最高(高,20)//最高20巴
down_num=20//尾随的20$
如果(低<轨迹\高-下\u数值)
警报代码
PS这将在蜡烛关闭后触发

尝试以下操作

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

down_num = 20 //the trailing 20$

if( low < trail_high - down_num)
    alert_code 
trail\u high=最高(高,20)//最高20巴
down_num=20//尾随的20$
如果(低<轨迹\高-下\u数值)
警报代码

PS这将在蜡烛关闭后触发

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