```
#RSI WatchList Column
input length = 14;
input over_Bought = 50;
input over_Sold = 50;
input price = close;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
def BEAR = over_Sold;
def BULL = over_Bought;
def UpSignal = if RSI crosses above BEAR then BEAR else Double.NaN;
def DownSignal = if RSI crosses below BULL then BULL else Double.NaN;
#
def sState = if close < UpSignal then -100 else if close > DownSignal then 100 else 0;
def sCount = CompoundValue(1, If(sState == 0, 0, if sState != sState[1] then 1 else sCount[1] + 1), 0);
def sCounter = If(sState > 0, sCount, -sCount);
plot sData = sCounter;
sData.assignValueColor(if sState > 0 then color.green else if sState < 0 then color.red else color.current);
```