在多个时间范围内寻找警报

问题描述

在30分钟图表上RSI14突破60时发出警告,如果1小时图表上RSI14高于60,并且在1日图表上RSI14超过60,则发出警告

基本上可以找到确认的看涨趋势,请帮助我实现这一目标。

解决方法

在这里,您是我的兄弟,下次再试一试,但以为我会帮助您。实际上,这非常简单,我也做到了,因此您可以分别调整每个RSI的长度。通读它,以便您了解它是如何工作的。我本人还是新手,但这应该可以正常工作。

//@version=4
study("MTF RSI",overlay=false)

//custom input for rsi lengths and timeframes
rsilen=input(14,minval=1,title="1st RSI Length",type=input.integer)
rsilen2=input(14,title="2nd RSI Length",type=input.integer)
rsilen3=input(14,title="3rd RSI Length",type=input.integer)
rsires=input("30",title="1st RSI Timeframe",type=input.resolution)
rsires2=input("60",title="2nd RSI Timeframe",type=input.resolution)
rsires3=input("1D",title="3rd RSI Timeframe",type=input.resolution)

//variables for each rsi
RSI1=rsi(close,rsilen)
RSI2=rsi(close,rsilen2)
RSI3=rsi(close,rsilen3)

//different timeframes for rsi
rsi1=security(syminfo.tickerid,rsires,RSI1)
rsi2=security(syminfo.tickerid,rsires2,RSI2)
rsi3=security(syminfo.tickerid,rsires3,RSI3)

//plots all 3 RSIs
plot(rsi1,title="1st RSI",color=color.red)
plot(rsi2,title="2nd RSI",color=color.green)
plot(rsi3,title="3rd RSI",color=color.blue)

//alert condition
alertcondition(rsi1 > 60 and rsi2 > 60 and rsi3 > 60,title="3 RSI Bullish",message="All 3 RSIs Bullish")