Webby's Quick & Grateful Dead RS For ThinkOrSwim

user636

New member
Author states: The Relative Strength (RS) line is something many investors are familiar with. It is used to measure a stocks performance versus the S&P 500 (default setting) and is typically calculated by dividing the closing price of the stock by the closing price of the S&P. This means if a stock moves up and the S&P moves down or the stock moves up more than the S&P the RS line will increase, if the stock moves down while the S&P moves up the line will decrease.

T9jSVky.png


Here is the original Tradingview code:
https://www.tradingview.com/script/qCW9Jwrv-Webby-s-Quick-Grateful-Dead-RS/

The new ThinkOrSwim code can be found in the next post.
 
Last edited by a moderator:
@samer800,
Could you convert Mike Webster's (aka Webby of IBD) "Quick and Grateful Dead RS" study or strategy?
https://www.tradingview.com/script/qCW9Jwrv-Webby-s-Quick-Grateful-Dead-RS/
check the below:

CSS:
#// Indicator for TOS
#// © Amphibiantrading
#indicator("Webby's Quick & Grateful Dead RS", overlay = true, shorttitle = 'QGDRS')
# Converted by Sam4Cok@Samer800    - 12/2024
declare lower;
input index   = "SPX"; # 'Index to Compare'
input ma1Type =  AverageType.SIMPLE; #('SMA',
input ma1Len  =  21; #, 'Quick Moving Average', mi
input ma2Type =  AverageType.SIMPLE; #('SMA', ' ', options = ['EMA', 'SMA'], inline = '3', group = g2)
input ma2Len  =  50; #, 'Slow Moving Average', minval = 3, maxval = 200, step = 1, group = g2, inline = '3')
input ma3Type =  AverageType.SIMPLE; #('SMA', ' ', options = ['EMA', 'SMA'], inline = '2', group = g3)
input ma3Len  =  8; #, 'Quick Moving Average', minval = 3, maxval = 50, step = 1, group = g3, inline = '2')
input ma4Type =  AverageType.SIMPLE; #('SMA', ' ', options = ['EMA', 'SMA'], inline = '3', group = g3)
input ma4Len  =  21; #, 'Slow Moving Average', minval = 3, maxval = 200, step = 1, group = g3, inline = '3')
input ma5Type =  AverageType.SIMPLE; #('SMA', ' ', options = ['EMA', 'SMA'], inline = '2', group = g4)
input ma5Len  =  12; #, 'Quick Moving Average', minval = 3, maxval = 50, step = 1, group = g4, inline = '2')
input ma6Type =  AverageType.SIMPLE; #('SMA', ' ', options = ['EMA', 'SMA'], inline = '3', group = g4)
input ma6Len  =  24; #, 'Slow Moving Average', minval = 3, maxval = 200, step = 1, group = g4, inline = '3')
input multi   =  35; #, 'Vertical offset of RS Line', minval=1, maxval=500, step=1, group = g5)

def na = Double.NaN;
def cap = GetAggregationPeriod();
def isdaily = cap >= AggregationPeriod.DAY and cap < AggregationPeriod.WEEK;
def isweekly = cap >= AggregationPeriod.WEEK and cap < AggregationPeriod.MONTH;
def ismonthly = cap >= AggregationPeriod.MONTH;
def spx = if close(Symbol = index) then close(Symbol = index) else spx[1];
def rs  = close / spx * 100;
def ma1 = MovingAverage(ma1Type, rs, ma1Len);
def ma2 = MovingAverage(ma2Type, rs, ma2Len);
def ma3 = MovingAverage(ma3Type, rs, ma3Len);
def ma4 = MovingAverage(ma4Type, rs, ma4Len);
def ma5 = MovingAverage(ma5Type, rs, ma5Len);
def ma6 = MovingAverage(ma6Type, rs, ma6Len);

#//variables
def qsLev;
def qsBool;
#// conditions
def quickBreak; def quickSand; def gdb; def reset;
if isdaily {
    quickBreak = (rs < ma1) and (rs[1] >= ma1[1]);
    quickSand  = rs < ma1 and rs < qsLev[1] and !qsBool[1];
    gdb        = (rs < ma2) and (rs[1] >= ma2[1]);
    reset      = (rs > ma1) and (rs[1] <= ma1[1]);
} else if isweekly {
    quickBreak = (rs < ma3) and (rs[1] >= ma3[1]);
    quickSand  = rs < ma3 and rs < qsLev[1] and !qsBool[1];
    gdb        = (rs < ma4) and (rs[1] >= ma4[1]);
    reset      = (rs > ma3) and (rs[1] <= ma3[1]);
} else {
    quickBreak = (rs < ma5) and (rs[1] >= ma5[1]);;
    quickSand  = rs < ma5 and rs < qsLev[1] and !qsBool[1];
    gdb        = (rs < ma6) and (rs[1] >= ma6[1]);
    reset      = (rs > ma5) and (rs[1] <= ma5[1]);
}
if quickBreak {
    qsLev = rs;
    qsBool = qsBool[1];
} else if quickSand {
    qsLev = qsLev[1];
    qsBool = yes;
} else if reset {
    qsLev  = 0;
    qsBool = no;
    } else {
    qsLev  = qsLev[1];
    qsBool = qsBool[1];
}

plot rsLine = rs * multi; #, 'RS', lineCol, rsWidth)
plot maD1 = if isdaily then ma1 * multi else na; #, 'Fast MA', ma1Color, maWidth)
plot maD2 = if isdaily then ma2 * multi else na; #, 'Slow MA', ma2Color, maWidth)
plot maW3 = if isweekly then ma3 * multi else na; #, 'Fast MA', ma3Color, maWWidth)
plot maW4 = if isweekly then ma4 * multi else na; #, 'Slow MA', ma4Color, maWWidth)
plot maM5 = if ismonthly then ma5 * multi else na; #, 'Fast MA', ma5Color, maMWidth)
plot maM6 = if ismonthly then ma6 * multi else na; #, 'Slow MA', ma6Color, maMWidth)

rsLine.SetLineWeight(2);
rsLine.SetDefaultColor(Color.CYAN);
maD1.SetDefaultColor(Color.RED);
maD2.SetDefaultColor(Color.YELLOW);
maW3.SetDefaultColor(Color.RED);
maW4.SetDefaultColor(Color.YELLOW);
maM5.SetDefaultColor(Color.RED);
maM6.SetDefaultColor(Color.YELLOW);


#-- Crosses
plot qBreak = if quickBreak then rsLine else na;
plot qSand  = if quickSand then rsLine else na;
plot gBreak = if gdb then rsLine else na;
qBreak.SetLineWeight(3);
qSand.SetLineWeight(3);
gBreak.SetLineWeight(3);
qBreak.SetPaintingStrategy(PaintingStrategy.SQUARES);
qSand.SetPaintingStrategy(PaintingStrategy.SQUARES);
gBreak.SetPaintingStrategy(PaintingStrategy.SQUARES);
qBreak.SetDefaultColor(Color.MAGENTA);
qSand.SetDefaultColor(Color.ORANGE);
gBreak.SetDefaultColor(Color.LIGHT_RED);
#-- END of CODE
 

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
228 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