I am trying to write some code with the aim that when the latest RSI is above 40 to show the long strategy. Both the weekly RSI and monthly RSI should be above 60.
study("rsi", overlay=true)
rsisource= input( title="rsisource", type=input.source, defval=close)
rsilength= input( title="rsisource", type=input.integer, defval=14)
rsivalue= rsi(rsisource, rsilength)
lrsi= input( title="dt", type=input.resolution, defval="D")
wrsi= input( title="dt", type=input.resolution, defual="W")
mrsi= input( title="dt", type=input.resolution, defual="M")
llr=crossover (rsivalue and lrsi, 40)
wwr=(rsivalue and wrsi > 60)
mmr=(rsivalue and mrsi > 60)
l1=(rsivalue and lrsi > 60)
if (llr and wwr and mmr)
strategy.entry("buy", strategy.long)
if (l1)
strategy.close("sell")