The Ringer aka Adaptive RSMK Indicator for ThinkorSwim

wtf_dude

wtf_dude

Active member
Just something I threw together when fiddling around with the RSMK and relative strength in general. All the RSMK (Markos Katsanos' relative strength) does is check your stock's performance against a benchmark index. The drawback is that you may not know at any given time what index is performing the best (qqq vs spy, etc). With this version, you can put your stock "through the ringer" by entering up to 6 indices to check performance against. The indicator will switch to checking strength against the top performer automatically. An additional recommendation I'll give is to make the indicator a watchlist column (copy pasting the code is fine) and using it to sort a watchlist to pick the best performers over your chosen time frame.

Code:
# The Ringer v1.0 - 9.6.20 by WTF_Dude
# One drawback of the regular RSMK is that you only choose one index to compare the stock or fund to.
# The best perorming index can constantly shift. So the Ringer allows you to enter up to 6 indexes
# to compare performance against. The indicator will constantly shift to checking the relative performance
# against the top index of the chosen 6. This indicator can be used as a watchlist column as well.

# based on study from Markos Katsanos and TD Ameritrade IP Company, Inc. (c) 2020
#

declare lower;

input security1 = "SPY";  # Main benchmark
input security2 = "QQQ";  # tech heavy
input security3 = "SLV";  # commodity or alt currency
input security4 = "ITB";  # real estate or homebuilders
input security5 = "IEF";  # safe haven
input security6 = "EEM";  # emerging markets

def a = close("security1") - close("security1")[90];
def b = close("security2") - close("security2")[90];
def c = close("security3") - close("security3")[90];
def d = close("security4") - close("security4")[90];
def e = close("security5") - close("security5")[90];
def f = close("security6") - close("security6")[90];


input rsLength = 90;
# Consider not only the common market time frames, but also
# calculating how many days back the last market bottom was
# and checking performance since then

input averageLength = 3;
# 3 for the average is used to help eliminate market noise, per the original indicator


def logRatio = Log(close / close(security1));
def RelativeStrength = 100 * ExpAverage(logRatio - logRatio[rsLength], averageLength);

def logRatio1 = Log(close / close(security2));
def RelativeStrength1 = 100 * ExpAverage(logRatio1 - logRatio1[rsLength], averageLength);

def logRatio2 = Log(close / close(security3));
def RelativeStrength2 = 100 * ExpAverage(logRatio2 - logRatio2[rsLength], averageLength);

def logRatio3 = Log(close / close(security4));
def RelativeStrength3 = 100 * ExpAverage(logRatio3 - logRatio3[rsLength], averageLength);

def logRatio4 = Log(close / close(security5));
def RelativeStrength4 = 100 * ExpAverage(logRatio4 - logRatio4[rsLength], averageLength);

def logRatio5 = Log(close / close(security5));
def RelativeStrength5 = 100 * ExpAverage(logRatio4 - logRatio4[rsLength], averageLength);


plot relativestrengthu = if relativestrength is less than relativestrength1 and relativestrength2 and relativestrength3 and relativestrength4  and relativestrength5 then relativestrength else if relativestrength1 is less than relativestrength and relativestrength2 and relativestrength3 and relativestrength4  and relativestrength5  then relativestrength1 else if relativestrength2 is less than relativestrength and relativestrength1 and relativestrength3 and relativestrength4  and relativestrength5 then relativestrength2 else if relativestrength3 is less than relativestrength and relativestrength1 and relativestrength2 and relativestrength4  and relativestrength5  then relativestrength3 else if relativestrength4 is less than relativestrength1 and relativestrength2 and relativestrength3 and relativestrength5 then relativestrength4 else relativestrength5;




RelativeStrengthu.SetPaintingStrategy(PaintingStrategy.Histogram);
RelativeStrengthu.DefineColor("Positive", Color.UPTICK);
RelativeStrengthu.DefineColor("Negative", Color.DOWNTICK);
RelativeStrengthu.AssignValueColor(if RelativeStrengthu >= 0 then RelativeStrengthu.Color("Positive") else RelativeStrengthu.Color("Negative"));

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GetColor(7));
 
Last edited:
MerryDay

MerryDay

Active member
VIP
@wtf_dude You help me take a different view of my investing with your contributions. Thank you for sharing.
 
wtf_dude

wtf_dude

Active member
Just updated my ringer sector picks for anybody interested (Based on performance since last month's correction)

VUG= broad market (vanguard growth)
SMH= strong sector (semis)
ITB = real estate (homebuilders)
KWEB= foreign/emerging (Chinese internet)
SGDJ =gold/silver (jr gold miners)
UUP = "cash" position (US dollar)

Also using 45 days as the time setting, for the moment
 
Last edited:

Similar threads

Top