2 Period RSI Trading Indicator for ThinkorSwim



New member
2019 Donor
Hi Ben, I saw a youtube video with a cool and simple trading strategy that uses the RSI as a trigger with over bought/oversold levels that are filtered out by a moving average of your choice. The link to the video is:


In essence, the user can define the moving average. Id prefer the 34 ema since I already use that on my charts. If price is above and RSI 2 period is below 10 then it is a dip buy opportunity. On the flip side if price is below the 34 ema and RSI is above 90 then it is a sell the rally opportunity.

Being able to run a scan for this would be nice. I did something simple using TOS but i know it isn't correct and gives me false alerts which I don't mind because at least it does show some decent looking opportunities I wouldn't have seen otherwise. The problem is I work too much to look at charts all day and figure out which ones I want or don't want to trade.
Last edited by a moderator:


See if this works for you. Included arrows to help you look for signals on the chart and also be able to use the Scanner with it.

# Simple 2 Period RSI Trading Indicator
# Assembled by BenTen at useThinkScript.com
# You are free to use this code for personal use, and make derivative works from it. You are NOT GRANTED permission to use this code (or derivative works) for commercial purposes which includes and is not limited to selling, reselling, or packaging with other commercial indicators. Headers and attribution in this code should remain as provided, and any derivative works should extend the existing headers.

# Start EMA
input price = close;
input length = 34;
input displace = 0;
#input showBreakoutSignals = no;

def AvgExp = ExpAverage(price[-displace], length);
#plot UpSignal = price crosses above AvgExp;
#plot DownSignal = price crosses below AvgExp;

input RSIlength = 2;
input over_Bought = 90;
input over_Sold = 10;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], RSIlength);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), RSIlength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
def OverSold = over_Sold;
def OverBought = over_Bought;

def emaBull = price > AvgExp;
def emaBear = price < AvgExp;

# Define Warning Signals
def bullish = RSI(length = RSIlength, averageType = averageType) < over_Sold and emaBull;
def bearish = RSI(length = RSIlength, averageType = averageType) > over_Bought and emaBear;

# Paint the Trend
#AssignPriceColor(if bullish then Color.DARK_GREEN else if bearish then Color.DARK_RED else Color.CURRENT);

plot bull = bullish;

plot bear = bearish;

Shareable Link

Last edited:


Well-known member
I just want to add. The most important thing to trade indicator is to understand what it means. RSI is - relative strength index. But what does period of 14 RSI with value 70 means? it means that 70% of time over the length the trend was rising. Not oversold , not overbought. But just precisely that
So by varying various length and tweaking "ob/os" we just tweaking indicator to tell us what kind of strength we looking for over what period of time

So RSI(2) 90/2 Is merely 4 bar ema strength signal (because 2 is wilders and wilders=2x EMA). with 90 means we want trend rising 90 of time(or 10 - conversely rising only 10 of time - e.g weakening). So there is no magic with this various length techniques. By using RSI(2)/RSI (14) you achieve confluence of larger price trend with shorter price trend. Whether it works on your particular timeframe and security is another matter

The most critical piece about oscillator like RSI is to determine the lenght. - e.g. the length over which cycle tend to occur. Using RSI OB/OS levels is in a way not much different than using candle count techniques (e.g 5 candles-in one trend - trend too overxtended. ) It is obvious why using OB/OS fails in long smooth trends - "the cycle" does not occur. it goes precisely as RSI tells it ( e.g over 80/90 candles are uptrending - nothing OB about it).
and hence why RSI/Stoch is a supposedely only good in ranged market (which typically have a clear cycle length)

Here is example of using RSI in different way:
1) find strong stock on long TF- e.g. "RSI(50)>70
2) On it find a shorter wave in sideways pullback RSI(21) ~50
3) And coming out of a downwave on faster timeframe RSI(13)crossing 50
Last edited:


New member
2019 Donor
@skynetgen Thx for the RSI tutorial. Definitely enlightening. I notice this kind of indicator suits a trending market so I will create a watchlist of stocks that mainly trend and use it on those.


New member
is there any chance this pinescript indicator transform for tos?

thanks in advance
//Created by ChrisMoody
//Based on Larry Connors RSI-2 Strategy - Lower RSI
study(title="_CM_RSI_2_Strat_Low", shorttitle="_CM_RSI_2_Strategy_Lower", overlay=false)
src = close,

up = rma(max(change(src), 0), 2)
down = rma(-min(change(src), 0), 2)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//Criteria for Moving Avg rules
ma5 = sma(close,5)
ma200= sma(close, 200)

//Rule for RSI Color
col = close > ma200 and close < ma5 and rsi < 10 ? lime : close < ma200 and close > ma5 and rsi > 90 ? red : silver

plot(rsi, title="RSI", style=line, linewidth=4,color=col)
plot(100, title="Upper Line 100",style=line, linewidth=3, color=aqua)
plot(0, title="Lower Line 0",style=line, linewidth=3, color=aqua)

band1 = plot(90, title="Upper Line 90",style=line, linewidth=3, color=aqua)
band0 = plot(10, title="Lower Line 10",style=line, linewidth=3, color=aqua)
fill(band1, band0, color=silver, transp=90)


Hi, I wanted to know if anyone can help me ...
Purchase Condition:
Time Frame M1
RSI (2) <10
Time Frame M5
RSI (7)> 60
RSI (7) <80
Time Frame M15
RSI (7)> 60
RSI (7) <80

Sale condition:
Time Frame M1
RSI (2)> 90
Time Frame M5
RSI (7) <40
RSI (7)> 20
Time Frame M15
RSI (7) <40
RSI (7)> 20

Is there a possibility of being in M1 and if the conditions in the three time frames are met, does an arrow appear indicating long or short?

Many thanks!!


2019 Donor

i see your comment here the idea is good but i m not very sure weather rsi(2) will hit below 10 on 1 min time frame while being above 60 in 5 min time frame because being above 60 on 5 min with rsi(7) is bullish but it still deserve a check

coz i am the one who introduce here rsi(7) >60 trading technique

i am not a coder so still its better that the developers in this forum shuld help it


@skynetgen what are you referring to when you use this line (~) And what time frame is this strategy used on?


Can someone help me create a scan based on this script. I want to scan for signals when RSI falls below 5.

# ConnorsRSI Indicator
declare lower;
input Price_RSI_Period = 3;
input Streak_RSI_Period = 2;
input Rank_Lookback = 100;
# Component 1: the RSI of closing price
def priceRSI = reference RSI("price" = close, "length" = Price_RSI_Period);
# Component 2: the RSI of the streak
def upDay = if close > close[1] then 1 else 0;
def downDay = if close < close[1] then -1 else 0;
def upStreak = if upDay != 0 then upStreak[1] + upDay else 0;
def downStreak = if downDay != 0 then downStreak[1] + downDay else 0;
def streak = upStreak + downStreak;
def streakRSI = reference RSI("price" = streak, "length" = Streak_RSI_Period);
# Component 3: The percent rank of the current return
def ROC1 = close / close[1] - 1;
def rank = fold i = 1 to Rank_Lookback + 1 with r = 0 do
r + (GetValue(ROC1, i, Rank_Lookback) < ROC1) ;
def pctRank = (rank / Rank_Lookback) * 100 ;
# The final ConnorsRSI calculation, combining the three components
plot ConnorsRSI = (priceRSI + streakRSI + pctRank) / 3;
Last edited by a moderator:
Prison Mike

Prison Mike

"connerRSI() is less than or equal to 5"

Study needs to be named connerRSI

This can be made in the "scan" portion of TOS
Prison Mike

Prison Mike

change "is less than or equal to" to "cross above" if you want to get them crossing on the way up.

Vimal Mittal

@martyrjohn I scanned and some of the results are not accurate. look at stocks like HD, LIN, NEE and COST not accurate? Can you tweak more accurate? Maybe RSI 2 Conners scan needs to be modified or because RSI should be wilder type ? I am not the expert.

Similar threads