by isamegrelo » Tue Oct 10, 2017 4:39 am
May be this is full code of ConnorsRSI?
study(title="CRSI", shorttitle="CRSI", overlay=false, precision=0)
rsilen = input(3, minval=1, title="RSI period")
streaklen = input(2, minval=1, title="Streak period")
lookback = input(100, title="ROC lookback")
rsi = rsi(close,rsilen)
upday = close > close[1] ? 1 : 0
downday = close < close[1] ? -1 : 0
upstreak = upday!=0 ? upstreak[1] + upday : 0
downstreak = downday!=0 ? downstreak[1] + downday : 0
streak = upstreak + downstreak
streakrsi = rsi(streak,streaklen)
roc = close/close[1] - 1
roccount = 0
for i=1 to lookback-1
roccount := roc[i]<roc ? roccount + 1 : roccount
crsi = (rsi + streakrsi + roccount) / 3
rsiplot=plot(crsi, title="RSI", style=line, linewidth=1, color=blue)
band1 = hline(85, title="Upper Line", linestyle=dashed, linewidth=1, color=red)
band0 = hline(20, title="Lower Line", linestyle=dashed, linewidth=1, color=green)
fill(band1, band0, color=purple, transp=90)