RSI Format, Label, Watchlist, Scan For ThinkOrSwim

It's effortless. Here is an example of how to set up a scanner for RSI crossing above the oversold line (30).

WuBQ4z7.png


Once you have this setup, you can also select the specific watchlist that you wish to scan in. This could be your own personal watchlist or any of the pre-built watchlists by ThinkorSwim.

Y23HC2V.png


By default, the scanner will run on the Daily (D) chart; you can change this to any other timeframe of your choice.
 
Hello All,

Brand new here, so I'll jump right in. Found this forum looking for some info on how to create a custom scan.

My trading idea is simple. There are stocks that have fairly set patterns of "oversold" RSI that, after a generally consistent period of time wander into "overbought".

The time frame I'm talking about is measured roughly in weeks.

FB, and MU are a couple of examples.

I'd be interested in finding as many stocks as I can that fit this pattern. Because well... it doesn't work 100% of the time so eggs in many baskets, and stocks that fit this pattern are not going to do it forever. Thus a scan.

Does anyone have anything like this?

My coding experience is limited to having written a simple function calculator (+, -, /, *) in C# back in 2006.
 
is there a way to modify it to show the 1hr RSI....on all my charts? I did something similar for ATR chart label.

i did this but the value is not coming up correctly

input BasePeriod = AggregationPeriod.HOUR;
input showlabel = yes;

def rsi = reference RSI("over bought" = 70, "over sold" = 30, price = close(period = AggregationPeriod.FOUR_DAYS));

AddLabel(yes, (Concat("RSI: ", Round(rsi, 2))), if rsi >= 70 then Color.RED else if rsi <= 30 then Color.GREEN else Color.WHITE);
 
it shows up only on the 1hr chart, is there a way to make it show on all charts

for reference this is what my ATR chart label is and it shows up on ALL charts

Code:
# ItsMeKola 08/2020
# Label color changes according to value of ATR:
# . Green if > 2
# . Lime if .50 to 1.99
# . Red if < .49
#

declare upper;

input ATRLength = 14;
input averagetype = AverageType.simple;
input BasePeriod = AggregationPeriod.DAY;
input showlabel = yes;

def ATR = MovingAverage (averagetype, TrueRange(high(period = BasePeriod)[1], close(period = BasePeriod)[1], low(period = BasePeriod)[1]), ATRLength);


DefineGlobalColor("ATRHigh", color.green);
DefineGlobalColor("ATRLow", Color.red);
DefineGlobalColor("ATRMid", Color.lime);

AddLabel (yes, (Concat("ATR: ", Round(ATR, 2))), if ATR > 2 then GlobalColor("ATRHigh") else if ATR < .49 then GlobalColor("ATRLow") else GlobalColor("ATRMid"));
 
The RSI Fractal indicator is really solid when you have an up or down arrow. I've tried to create a scan to show me stocks that have a up or down arrow within the last bar but have failed. I'm trying to scan for stocks at the end of the day primarily for swing trade candidates. Any help would be greatly appreciated.

Code:
# RSIwithFractalPivots_Amalia

# reposted to chatroom 04.18.2018



########START  Code



declare lower;



input length = 14;

input over_Bought = 70;

input over_Sold = 30;

input price = close;

input averageType = AverageType.WILDERS;

input New_HI_LO = 30;





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;



plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;

plot OverBought = over_Bought;



RSI.DefineColor("OverBought", GetColor(5));

RSI.DefineColor("Normal", GetColor(7));

RSI.DefineColor("OverSold", GetColor(1));

RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));

OverSold.SetDefaultColor(GetColor(8));

OverBought.SetDefaultColor(GetColor(8));



plot NEWHIGH = if RSI == highest(RSI, new_HI_LO) then RSI else Double.NAN; 

NEWHIGH.setpaintingStrategy(paintingStrategy.POINTS);

NEWHIGH.setdefaultColor(color.light_green);

NewHIGH.setlineWeight(1);



plot NEWLOW = if RSI == lowest(RSI, new_HI_LO) then RSI else Double.NAN; 

NEWLOW.setpaintingStrategy(paintingStrategy.POINTS);

NEWLOW.setdefaultColor(color.light_RED);

NEWLOW.setlineWeight(1);



# Fractals

# 1/5/17 Amalia added Aggregation periods?



def H = RSI; 

def L = RSI; 



input sequenceCount = 10;



def maxSideLength = sequenceCount + 10;

def upRightSide = fold i1 = 1 to maxSideLength + 1 

                  with count1 

                  while count1 != sequenceCount and 

                        count1 != -1 

                  do if GetValue(H, -i1) > H or 

                       (GetValue(H, -i1) == H and

                        count1 == 0) 

                     then -1

                     else if GetValue(H, -i1) < H 

                          then count1 + 1 

                          else count1;

def upLeftSide = fold i2 = 1 to maxSideLength + 1 

                 with count2 

                 while count2 != sequenceCount and 

                       count2 != -1 

                 do if GetValue(H, i2) > H or 

                      (GetValue(H, i2) == H and 

                       count2 >= 1) 

                    then -1

                    else if GetValue(H, i2) < H 

                         then count2 + 1 

                         else count2;

def downRightSide = fold i3 = 1 to maxSideLength + 1 

                    with count3 

                    while count3 != sequenceCount and 

                          count3 != -1 

                    do if GetValue(L, -i3) < L or 

                         (GetValue(L, -i3) == L and 

                          count3 == 0) 

                          then -1

                        else if GetValue(H, -i3) > L 

                             then count3 + 1 

                             else count3;

def downLeftSide = fold i4 = 1 to maxSideLength + 1 

                   with count4 

                   while count4 != sequenceCount and 

                         count4 != -1

                   do if GetValue(L, i4) < L or 

                        (GetValue(L, i4) == L and 

                         count4 >= 1) 

                      then -1

                      else if GetValue(L, i4) > L 

                      then count4 + 1 

                      else count4;



plot UpFractal = if upRightSide == sequenceCount and 

                    upLeftSide == sequenceCount 

                 then RSI 

                 else Double.NaN;

plot DownFractal = if downRightSide == sequenceCount and 

                      downLeftSide == sequenceCount 

                   then RSI

                   else Double.NaN;



UpFractal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

UpFractal.SetDefaultColor(color.RED);

UpFractal.SetLineWeight(2);

DownFractal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownFractal.SetDefaultColor(color.GREEN);

DownFractal.SetLineWeight(2);





def Pre_hi = if !isnan(upfractal) then upfractal else pre_hi[1];



plot high_line = pre_hi;

high_line.setpaintingStrategy(paintingStrategy.DASHES);

high_line.setdefaultColor(color.CYAN);



def Pre_lo = if !isnan(downFractal) then downFractal else pre_lo[1];



plot lo_line = pre_lo;

lo_line.setpaintingStrategy(paintingStrategy.DASHES);

lo_line.setdefaultColor(color.MAGENTA);



addlabel(yes, 

if RSI >= OverBought && RSI >= RSI[1]

    then "RSI OB & Rising: " +round(RSI, 2)

else if RSI >= OverBought && RSI < RSI[1]

    then "RSI OB & Falling: " +round(RSI, 2)

else if RSI <= OverSold && RSI < RSI[1]

    then "RSI OS & Falling: " +round(RSI, 2)

else if RSI <= OverSold && RSI >= RSI[1]

    then "RSI OS & Rising: " +round(RSI, 2)

else if RSI < OverBought && RSI > OverSold && RSI >= RSI[1]

    then "RSI Rising: " +round(RSI, 2)

else if RSI < OverBought && RSI > OverSold && RSI < RSI[1]

    then "RSI Falling: " +round(RSI, 2)

else "",

if RSI >= OverBought && RSI >= RSI[1]

    then color.dark_orange

else if RSI >= OverBought && RSI < RSI[1]

    then color.yellow

else if RSI <= OverSold && RSI < RSI[1]

    then createcolor(000, 100, 100)

else if RSI <= OverSold && RSI >= RSI[1]

    then color.cyan

else if RSI < OverBought && RSI > OverSold && RSI >= RSI[1]

    then color.green

else if RSI < OverBought && RSI > OverSold && RSI < RSI[1]

    then color.red

else color.gray);





plot Buffer = if RSI <= OverSold then RSI - 10 else if RSI >= OverBought then RSI + 10 else double.nan;

Buffer.setdefaultColor(color.black);

Buffer.hidetitle();

Buffer.hidebubble();



####END Code
 
The following chart shows strength in symbols with RSI above 60 and daily RSI > weekly RSI. This is done by me with Tradestation.

Can we develop explore the idea with TOS? I would appreciate a scan for thinkorswim.

oBWXLZM.png


BmGytXG.jpg
 
Last edited by a moderator:
Is it possible to show 2 or more RSI labels on a chart. For example 5 min RSI and 15 min RSI labels. If I am on the 5 min chart, it will show both 5 min RSI and 15 min RSI. If I am on 15 min chart, it will only show 15 min RSI. Thank you in advance. See the script I started below, but both the 5min RSI and 15min are coming up with the same value, which is not correct.

Code:
#Show/hide aggregation periods

input show5m  = yes;#Hint show5m:5 minutes
input show15m = yes;#Hint show15m:15 minutes


### 1m timeframe ###
def tf1m = AggregationPeriod.MIN;

def rsi = reference RSI("over bought" = 95, "over sold" = 5, price = close(period = AggregationPeriod.FIVE_MIN));
AddLabel(yes,"RSI1m ", if rsi >= 50 or rsi <= 50 then Color.RED else Color.GREEN);

### 5m timeframe ###
def tf5m = AggregationPeriod.five_MIN;

def rsi5 = reference RSI("over bought" = 95, "over sold" = 5, price = close(period = AggregationPeriod.FIFTEEN_MIN));
AddLabel(yes, "RSI5m", if rsi >= 50 or rsi <= 50 then Color.RED else Color.GREEN);
 
Good afternoon all. Really liking this indicator and looking from some advice on how to tweak this label. Specifically...

Rising - light green
Falling - light red
Over 70 - dark red
Under 30 - dark green
Flat - gray

Something like this possible?
 
Hello,
I am adding the daily RSI value as a column in my watchlist.
If I pick price = close. Does it mean that the RSI value is updated only at the close of the day? If I want a more dynamic value. I have to choose (H+L)/2. Correct?
thanks

2020-11-05-17-28-58.png
 
So I tried my best to do this on my own...but since I am not a coder I fell short once again. I am hoping that a competent coder can assist with my request.

I am looking for a RSI watchlist column that can be sortable and one that counts the amount of candles that are ABOVE or BELOW 50.

Here is what I came up with from the various lines of codes I put together. Would really appreciate the help. Thanks.

Code:
#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);

Here is a pic of what I am looking for...A RSI watch list column where it counts how many GREEN and RED candle there are above the 50.

GfCUb1k.png
 
Could someone please help me find RSi scanner for TOS that will scan for RSI cross under Oversold and overbought values both set to lets say 90, cross less than both values combined? Instead of having the typical 2 separate values of 30 and 70, require both combined at lets say "30" or "70" and want the cross greater or less than scanner for my want and needs over 7,8,9 min aggregation instead of pre set 5, 10 ones if possible?
I have searched the forum and could not find something like this.
 
i wish to find stocks moving across 49 ma and rsi(14) over 69 , what is the most efficient way to search, a scan, column watchlist , or marketplace ?
 
You can easily set that up using the scanner. Something like this would work.

i76WV0T.png


Code:
close crosses above SimpleMovingAvg("length" = 49)."SMA" and RSI()."RSI" is greater than 69
 
There is the possibility of creating an alert, for example that warns me when the RSI crosses 60 ... and that this alert remains in effect indefinitely until I decide it ... every time I put an alert, it warns me, but then the alert is no longer in effect.
Thank you!
 
I just copied TOS' RSI study,, made a new study and added alerts in the code. Mine plays a bell when the RSI crosses above OverSold (30) and a ring when RSI crosses below Overbought (70). I also added vertical lines.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
# Revised to add Alerts

declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

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;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
Alert(UpSignal, "Possible Long", Alert.BAR, Sound.Bell);
AddVerticalLine (UpSignal, "", Color.GREEN);
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;
Alert(DownSignal, "Possible Short", Alert.BAR, Sound.Ring);

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
203 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top