Archives: RSM Indicator for ThinkorSwim

Status
Not open for further replies.
I haven't been able to figure it out yet. I know the scan works on the weekly chart but I'm not much of coder so I don't know how to color bars on weekly chart.
@trendr @JohnsonM RSM Works on Weekly, we do show the trend on Weekly, what you are must be looking for is ADR/ATR ranges. Unfortunately given the amount of data used in their calculations it's not feasible to project ADR/ATR ranges on weekly, charts. try use RSI Laguerre_MTF for range projections on weekly. Search that work here in this forum, there are plenty of threads on that topic.

-S
 

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

@trendr @JohnsonM RSM Works on Weekly, we do show the trend on Weekly, what you are must be looking for is ADR/ATR ranges. Unfortunately given the amount of data used in their calculations it's not feasible to project ADR/ATR ranges on weekly, charts. try use RSI Laguerre_MTF for range projections on weekly. Search that work here in this forum, there are plenty of threads on that topic.

-S
That makes sense thanks @SuryaKiranC
 
Those are candle types TOS defaults you are looking for, FullBody's are sell off and Hollow Candles are BuyUP. RSM overrides the color of TOS candles, so Don't Consider the Red and Greens as TOS default Colors, they are respective RSM Trends as defined.

-S
Hey SuryaKiranC, thank you for the reply, but still don't understand. It may be the noob in me, but the TOS candles I understand, it is the RSM candles I am trying to understand. What is the difference between between the RSM hallow vs full candles, both red and green?
 
@HSI1600 Are you saving the scanner script as a TOS study and referring to it a

The hollow candles or full candles has nothing to do with RSM, you got that part right? Do me a favor put two TOS charts side by side one with the RSM one with out and same ticker, same timeframe on both charts. Hollow candles are where the price action on the stock is going up, it might be a red candle on non RSM chart but still price action is going up, on a standard chart candle color is determined by the high low of the previous candle, hollow or full body is determined by the price action. there are plenty of other candle types the charts supports too. For general help on TOS candle types, I would suggest to go through quick Youtube videos.
I did not copy the whole code. It is working now - thanks
 
Hey SuryaKiranC, thank you for the reply, but still don't understand. It may be the noob in me, but the TOS candles I understand, it is the RSM candles I am trying to understand. What is the difference between between the RSM hallow vs full candles, both red and green?
The hollow candles or full candles has nothing to do with RSM, you got that part right? Do me a favor put two TOS charts side by side one with the RSM one with out and same ticker, same timeframe on both charts. Hollow candles are where the price action on the stock is going up, it might be a red candle on non RSM chart but still price action is going up, on a standard chart candle color is determined by the high low of the previous candle, hollow or full body is determined by the price action. there are plenty of other candle types the charts supports too. For general help on TOS candle types, I would suggest to go through quick Youtube videos.
 
I am comparing RSM Upper and Lower clouds green and red...lower shows earlier than upper. Both have same settings. Any advice?
What all setting you have on Lower, Coz lower supports, RSI, MACD and Stochastic alone as well as RSI and Stochastic together. What I normally do is add 3 instance of lowers and set each instance to RSI, MACD and Stochastic. The Upper indicator will show Green/Red only when all 3 are in the same trend.
 
I am using the RSM_Lower_v1.3, does it not have RSI, MACD and Stochastic together? I am using the settings mentioned on page 1.
No, Read the Features section of the Lower Indicator. Both is RSI & Stochastic Together. if you have screen big enough I would set them individually in 3 different instance. That's my personal preference. so I have eyes on each of them individually. Also, if you are using upper indicator, you may want to turn off paintbars in the lower indicator all instance.

RSM Lower​

Features
  1. 3 Indicators in 1
    1. RSI - Only
    2. Stochastic - Only
    3. RSI & Stochastic
    4. MACD - Only
  2. Will shade lower area when trend is confirmed for each indicator individually
  3. All settings for each indicator made avaiable in settings for user configuration
  4. Paint Bars if not used with upper study - user configurable
 
Thank you, is there any reason fifth option to combine all three not available for lower indicator?
You can do whatever you want. you can poke around the code and add the 5th option. most of the code you need exist already in the upper indicator. Just port it. We didn't see a reason for repetition of the same as upper indicator. As for the suite we are already doing this in the upper and wanted to track individual indicators in the lowers.
 
5 years Daily Chart of back testing of SPX and SPY results with different variation of the moving average related setting of RSM indicator.
First result is SPX, second is SPY.

Observation: TOS default settings yield better results
RSI Stoc MACD
wild simp exp (default TOS setting)

Entry Criteria: All Green
Exit Criteria: At least one is red

RSI Stoc MACD(In the same sequence)
wild simp exp (default TOS setting)

SPX:
Total P/L: $3,319.03
Total order(s): 58

SPY:
Total P/L: $3,525.70
Total order(s): 64

exp exp exp
Total P/L: $3,154.25
Total order(s): 77

Total P/L: $3,390.65
Total order(s): 77

exp exp wild
Total P/L: $3,071.59
Total order(s): 75

Total P/L: $2,690.67
Total order(s): 77

wild weigh wild
Total P/L: $2,626.41
Total order(s): 49

Total P/L: $2,453.95
Total order(s): 55

exp wild exp
Total P/L: $2,566.31
Total order(s): 77

Total P/L: $3,200.08
Total order(s): 76

simp simp simp
Total P/L: $2,506.77
Total order(s): 65

Total P/L: $2,278.92
Total order(s): 65

exp exp weig
Total P/L: $1,776.61
Total order(s): 77

Total P/L: $2,192.38
Total order(s): 77

exp wild weig
Total P/L: $1,193.58
Total order(s): 77

Total P/L: $2,097.80
Total order(s): 74

wild wild weigh
Total P/L: $1,234.88
Total order(s): 68

Total P/L: $1,959.82
Total order(s): 65

exp exp simp
Total P/L: $1,042.73
Total order(s): 75

Total P/L: $1,504.14
Total order(s): 76
 
5 years Daily Chart of back testing of SPX and SPY results with different variation of the moving average related setting of RSM indicator.
First result is SPX, second is SPY.
That's an awesome job. Thank you for that comparison. Would you try this on some volatile ticker though?? something like a TSLA, SHOP, AMZN or any other that is too wild and too moody.

-Surya
 
5 years daily chart, got mixed results:

TSLA
wild simp exp
Total P/L: $28,570.39
Total order(s): 66

exp exp exp
Total P/L: $35,092.30
Total order(s): 45

exp wild weig
Total P/L: $23,070.24
Total order(s): 68

--------------------
--------------------------
AAPL
wild simp exp
Total P/L: $10,688.02
Total order(s): 55

exp exp exp
Total P/L: $9,724.95
Total order(s): 77

exp wild weigh
Total P/L: $4,810.85
Total order(s): 71

------------------------
GOOGL
wild simp exp
Total P/L: $546.53
Total order(s): 70

exp exp exp
Total P/L: $1,750.65
Total order(s): 83

exp wild weigh
Total P/L: $2,378.92
Total order(s): 73
------------------------
AMZN
wild simp exp
Total P/L: $4,307.83
Total order(s): 70

exp exp exp
Total P/L: $3,443.84
Total order(s): 87

exp wild weigh
Total P/L: $4,837.43
Total order(s): 84
 
Good morning!
This is incredible work, I am so impressed.

For the life of me, I cannot get the scans to work. Do I copy and paste the whole code on the box or only portions? I feel like an *****.
 
Perfect.
Code for Watchlist Posed per Request.

Code:
# RSM_WL
#
#CHANGELOG
# 2021.1.31 - V1.0 @SuryaKiranC - RSM Watch List study - to be used as watchlist:
#              Based on @Cos251 RSM_SCAN Code.
#            - Stocks currently in UpTrend
#            - Stocks currently in DownTrend
#            - Stocks where UpTrendJustSarted - first bar of UpTrend for scanend TF
#            - Stocks where DownTrendJustStarted - first bar of DownTrend for scanned TF
#            - Stocks where UpTredJustEnded - first NO Trend bar after UpTrend
#            - Stocks where DownTrendJustEnded - first NO Trend bar after DownTrend
#            - Recommend using default studies for SCANS of RSI, Stochastics or MACD for efficiency
#           
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 14 and 3 WILDERS
#               MACD 12,26,9 WEIGHTED
#
#
#CREDITS
# requesed by "@Joseph Patrick 18"
#
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#
################################################################
##########                 RSI                         #########
################################################################

def lengthRSI = 7;
def price = close;
def averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

################################################################
##########                 Stochastic Slow             #########
################################################################
def over_boughtSt = 80;
def over_soldSt = 20;
def KPeriod = 14;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def averageTypeStoch = AverageType.WILDERS;
def SlowK = reference StochasticFull(over_boughtSt,  over_soldSt,  KPeriod,  DPeriod,  priceH,  priceL,  priceC,  3, if (averageTypeStoch == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullK;
def SlowD = reference StochasticFull(over_boughtSt,  over_soldSt,  KPeriod,  DPeriod,  priceH,  priceL,  priceC,  3, if (averageTypeStoch == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullD;

#################################################################
############           MACD Calculation                 #########
#################################################################
def fastLength = 12;
def slowLength = 26;
def MACDLength = 9;
def averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close, fastLength) - MovingAverage(averageTypeMACD, close, slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;

#################################################################
############          SCAN Variables                    #########
#################################################################

# If you want to scan for stocks that are not in either trend you can add two filters and scan for false for both conditions

# The UpTrend and DownTrend plots can be used to scan for stocks that are currently in that trend
def UpTrend = if RSI > 50 and SlowK > 50 and Value > Avg then 1 else 0;
def DownTrend = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;

# The UpTrendJustStarted and DownTrendJustStarted plots can be used to find stocks that have just started
# a trend in either direction
def UpTrendJustStartedBool = if RSI > 50 and SlowK > 50 and Value > Avg then 1 else 0;
def DownTrendJustStartedBool = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;
def UpTrendJustStarted = if UpTrendJustStartedBool == 1 and UpTrendJustStartedBool[1] == 0 then 1 else 0;
def DownTrendJustStarted = if DownTrendJustStartedBool == 1 and DownTrendJustStartedBool[1] == 0 then 1 else 0;
def UpTrendJustEnded = if UpTrendJustStartedBool[1] == 1 and UpTrendJustStartedBool == 0 then 1 else 0;
def DownTrendJustEnded = if DownTrendJustStartedBool[1] == 1 and DownTrendJustStartedBool == 0 then 1 else 0;

def GetTrend = if UptrendJustStarted then 3 else if Uptrend then 2 else if UpTrendJustEnded then 1 else if DownTrendJustStarted then -1 else if DownTrend then -2 else if DownTrendJustEnded then -3 else 0;

AddLabel (yes, if GetTrend == 3 then "UpTrendJustStarted" else if GetTrend == 2 then "UpTrend" else if GetTrend == 1 then "UpTrendJustEnded" else if GetTrend == -1  then "DownTrendJustStarted" else if GetTrend == -2  then "DownTrend" else if GetTrend == -3 then "DownTrendJustEnded" else "NoTrend",Color.BLACK);

AssignBackgroundColor( if GetTrend == 3 then Color.LIGHT_GREEN else if GetTrend == 2 then Color.Green else if GetTrend == -1 then Color.LIGHT_RED else if GetTrend == -2 then Color.RED else Color.WHITE);

Version 1.1 For watch list with BarCount Since Up/Down Trend has started. Only for those 2 trends coded for now. Please use Version 1.0 if you have performance concerns, I haven't tested the code during market hours yet.

Code:
# RSM_WL
#
#CHANGELOG
# 2021.3.5  - V1.1 @SuryaKiranC - BarCount for how long Up/Down Trend is in progress.
# 2021.1.31 - V1.0 @SuryaKiranC - RSM Watch List study - to be used as watchlist:
#              Based on @Cos251 RSM_SCAN Code.
#            - Stocks currently in UpTrend
#            - Stocks currently in DownTrend
#            - Stocks where UpTrendJustSarted - first bar of UpTrend for scanend TF
#            - Stocks where DownTrendJustStarted - first bar of DownTrend for scanned TF
#            - Stocks where UpTredJustEnded - first NO Trend bar after UpTrend
#            - Stocks where DownTrendJustEnded - first NO Trend bar after DownTrend
#            - Recommend using default studies for SCANS of RSI, Stochastics or MACD for efficiency
#             
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 14 and 3 WILDERS
#               MACD 12,26,9 WEIGHTED
#
#
#CREDITS
# requesed by "@Joseph Patrick 18"
#
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#
################################################################
##########                 RSI                         #########
################################################################

def lengthRSI = 7;
def price = close;
def averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

################################################################
##########                 Stochastic Slow             #########
################################################################
def over_boughtSt = 80;
def over_soldSt = 20;
def KPeriod = 14;
def DPeriod = 3;
def priceH = high;
def priceL = low;
def priceC = close;
def averageTypeStoch = AverageType.WILDERS;
def SlowK = reference StochasticFull(over_boughtSt,  over_soldSt,  KPeriod,  DPeriod,  priceH,  priceL,  priceC,  3, if (averageTypeStoch == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullK;
def SlowD = reference StochasticFull(over_boughtSt,  over_soldSt,  KPeriod,  DPeriod,  priceH,  priceL,  priceC,  3, if (averageTypeStoch == 1) then AverageType.SIMPLE else AverageType.EXPONENTIAL).FullD;

#################################################################
############           MACD Calculation                 #########
#################################################################
def fastLength = 12;
def slowLength = 26;
def MACDLength = 9;
def averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close, fastLength) - MovingAverage(averageTypeMACD, close, slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;



#################################################################
############          SCAN Variables                    #########
#################################################################

# If you want to scan for stocks that are not in either trend you can add two filters and scan for false for both conditions

# The UpTrend and DownTrend plots can be used to scan for stocks that are currently in that trend
def UpTrend = if RSI > 50 and SlowK > 50 and Value > Avg then 1 else 0;
def DownTrend = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;

def bnumUp;
def bnumDown;
def closeUpTrendStart;
def closeDownTrendStart;
def UpTrendBarCount;
def DownTrendBarCount;
if UpTrend and (!UpTrend[1] or DownTrend[1]) {
    bnumUp = BarNumber();
    bnumDown = 0;
    closeUpTrendStart = close;
    closeDownTrendStart = 0;
    UpTrendBarCount = 1;
    DownTrendBarCount = 0;
} else if UpTrend {
    bnumUp = bnumUp[1];
    bnumDown = 0;
    closeUpTrendStart = closeUpTrendStart[1];
    closeDownTrendStart = 0;
    UpTrendBarCount = UpTrendBarCount[1] + 1;
    DownTrendBarCount = 0;
} else if DownTrend and (!DownTrend[1] or UpTrend[1]) {
    bnumUp = 0;
    bnumDown = BarNumber();
    closeDownTrendStart = close;
    closeUpTrendStart = 0;
    UpTrendBarCount = 0;
    DownTrendBarCount = 1;
} else if DownTrend {
    bnumDown = bnumDown[1];
    closeDownTrendStart = closeDownTrendStart[1];
    DownTrendBarCount = DownTrendBarCount[1] + 1;
    bnumUp = 0;
    closeUpTrendStart = 0;
    UpTrendBarCount = 0;
} else {
    bnumUp = 0;
    bnumDown = 0;
    closeUpTrendStart = 0;
    closeDownTrendStart = 0;
    UpTrendBarCount = 0;
    DownTrendBarCount = 0;
}

# The UpTrendJustStarted and DownTrendJustStarted plots can be used to find stocks that have just started
# a trend in either direction
def UpTrendJustStartedBool = if RSI > 50 and SlowK > 50 and Value > Avg then 1 else 0;
def DownTrendJustStartedBool = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;
def UpTrendJustStarted = if UpTrendJustStartedBool == 1 and UpTrendJustStartedBool[1] == 0 then 1 else 0;
def DownTrendJustStarted = if DownTrendJustStartedBool == 1 and DownTrendJustStartedBool[1] == 0 then 1 else 0;
def UpTrendJustEnded = if UpTrendJustStartedBool[1] == 1 and UpTrendJustStartedBool == 0 then 1 else 0;
def DownTrendJustEnded = if DownTrendJustStartedBool[1] == 1 and DownTrendJustStartedBool == 0 then 1 else 0;

def GetTrend = if UptrendJustStarted then 3 else if Uptrend then 2 else if UpTrendJustEnded then 1 else if DownTrendJustStarted then -1 else if DownTrend then -2 else if DownTrendJustEnded then -3 else 0;

AddLabel (yes, if GetTrend == 3 then "UpTrendJustStarted" else if GetTrend == 2 then "BC:" + UpTrendBarCount + " UpTrend" else if GetTrend == 1 then "UpTrendJustEnded" else if GetTrend == -1  then "DownTrendJustStarted" else if GetTrend == -2  then "BC:" + DownTrendBarCount + " DownTrend" else if GetTrend == -3 then "DownTrendJustEnded" else "NoTrend",Color.BLACK);

AssignBackgroundColor( if GetTrend == 3 then Color.LIGHT_GREEN else if GetTrend == 2 then Color.Green else if GetTrend == -1 then Color.LIGHT_RED else if GetTrend == -2 then Color.RED else Color.WHITE);

How do I "build" this watch list? Do I copy/paste this into a study, save the study?
 
How do I "build" this watch list? Do I copy/paste this into a study, save the study?
Thank you so much for posting this. How do I "use" it? Do I need to copy/paste the code into a scan? I don't know how to create a watchlist from this...I have never done that in TOS. I've only manually built watchlists
 
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
294 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