IBD Stock Charts Style and Scan for ThinkorSwim

The Innovators IBD 50 ETF - FFTY holdings are available directly from Innovator's website at https://www.innovatoretfs.com/etf/?ticker=ffty&ticker=ffty#holdings
I do not know anything about the above website and cannot attest to the veracity of its information or why its IBD 50 csv file contains 100 stocks.
But for those that want to check it out, here is a watchlist created from the above link:
Shared Watchlist Link: http://tos.mx/lScuiJf Click here for --> Easiest way to load shared links
Twz18p9.png
 
I do not know anything about the above website and cannot attest to the veracity of its information or why its IBD 50 csv file contains 100 stocks.
But for those that want to check it out, here is a watchlist created from the above link:
Shared Watchlist Link: http://tos.mx/lScuiJf Click here for --> Easiest way to load shared links
Twz18p9.png
My understanding is that this ETF is from the Innovator ETF Family under license from IBD. It was once called the IBD 100, years ago. That might be a clue. I'm not certain. Much like the CANSLIM list that is printed in IBD from NorthCoast Asset Mgmt, It is licensed to them and their holdings actually bear little resemblance to IBD traits. I know this as I hired them as an RIA a few years back.
 
hey, @markos -- i see you're still around here, so i thought i'd ask a question about the chande trend meter that you provided:
https://usethinkscript.com/threads/...and-scan-for-thinkorswim.532/page-2#post-7397

which i also asked over at yee old thinkscript lounge to no avail. anyway, at the time of your post, it seems like you were using the CTME both on the chart and as a watchlist column. when i do that, i get different results because my preference is for a 3 mo / 1 day screen and the study varies its output depending on your time frame. i gather that the watchlist column is more or less hard coded to 253 days, so to get the same on my chart, i'd have to set it for a year, which i'd rather not.

the TSL folks told me there's no way around this. was this ever an issue that came up for you?

stockcharts . com also has the TME as one of its indicators but they have it coded so the output on the screen is the same no matter what the time frame is.

twas suggested that perhaps the answer here is to code the chart study so that it relies on 253 days regardless of time frame using the barnumber() function but that's beyond me. care to take a look?
 
Last edited by a moderator:
hey, @markos -- i see you're still around here, so i thought i'd ask a question about the chande trend meter that you provided:
https://usethinkscript.com/threads/...and-scan-for-thinkorswim.532/page-2#post-7397

which i also asked over at yee old thinkscript lounge to no avail. anyway, at the time of your post, it seems like you were using the CTME both on the chart and as a watchlist column. when i do that, i get different results because my preference is for a 3 mo / 1 day screen and the study varies its output depending on your time frame. i gather that the watchlist column is more or less hard coded to 253 days, so to get the same on my chart, i'd have to set it for a year, which i'd rather not.

the TSL folks told me there's no way around this. was this ever an issue that came up for you?

stockcharts . com also has the TME as one of its indicators but they have it coded so the output on the screen is the same no matter what the time frame is.

twas suggested that perhaps the answer here is to code the chart study so that it relies on 253 days regardless of time frame using the barnumber() function but that's beyond me. care to take a look?
I wouldn't mess with the CTM. Trade Desk on a 1 year chart shows the same as my watchlist and label. It reads 29. When I put it on a 90 day/2hour chart, I get 6.5. Looking at the code, it adds up all of the features out to 100 periods for the Bollinger Bar portion. I won't try it, but you may want to take the total that it adds up and divide that by 4 to give you 90 days. But remember, if Tuchar Chande had wanted it for lower time frames, he would have made it easier for Mobius to code that for me. Mobius coded it exact from the Stockcharts site.
Below is my Label Code:
Code:
# Chande Trend Meter (CTM)
# Mobius 9-11-2019
# Scores the stock's trend, based on several technical indicators over six different timeframes. Bollinger Bands,Std Dev,14-Day RSI, & 2D Price Channel Break Out's.
# The position of high, low, and close, relative to Bollinger Bands in four different timeframes (20-day, 50-day, 75-day, and 100-day)
# The price change relative to the standard deviation over the past 100 days
# The 14-day RSI value
# The existence of any short-term (2-day) price channel breakouts

# The scales for CTM:
# Stocks with a score of 90-100 are in very strong uptrends
# Stocks with a score of 80-90 are in strong uptrends
# Stocks with a score of 60-80 are in weak uptrends
# Stocks with a score of 20-60 are either flat or in weak downtrends
# Stocks with a score of 0-20 are in very strong downtrends
# Note: Since I could not find anything on scoring each indicator I gave them all equal weight and scaled the final sum to a range from 0 to 100;

#declare lower;
declare upper;

def h = high;
def l = low;
def c = close;
script Scale {
    input c = close;
    input Min = 0;
    input Max = 100;
    def hh = HighestAll(c);
    def ll = LowestAll(c);
    plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
}
script BB
    {
    input price = close;
    input length = 20;
    def avg = Average(price, length);
    def sd = StDev(price, length);
    def upperBand = avg + (2 * sd);
    def lowerBand = avg - (2 * sd);
    plot PercentB = (price - lowerBand) / (upperBand - lowerBand) * 10;
}
def BB20H = BB(h, 20);
def BB20L = BB(l, 20);
def BB20C = BB(c, 20);
def BB50H = BB(h, 50);
def BB50L = BB(l, 50);
def BB50C = BB(c, 50);
def BB75H = BB(h, 75);
def BB75L = BB(l, 75);
def BB75C = BB(c, 75);
def BB100H = BB(h, 100);
def BB100L = BB(l, 100);
def BB100C = BB(c, 100);
def zScore = ((c - Average(c, 100)) / StDev(c, 100)) * 10;
def RSI = RSI() / 10;
def PriceChannel = ((c - Lowest(l, 2)) / (Highest(h, 2) - Lowest(l, 2))) * 10;
def sum = BB20H + BB20L + BB20C + BB50H + BB50L + BB50C + BB75H + BB75L + BB75C + BB100H + BB100L + BB100C + zScore + RSI + PriceChannel;
plot CTM = scale(sum);
#plot "90" = if isNaN(c) then double.nan else 90;
#plot "80" = if isNaN(c) then double.nan else 80;
#plot "60" = if isNaN(c) then double.nan else 60;
#plot "20" = if isNaN(c) then double.nan else 20;
AddLabel(yes, "CTM/RS  " + Round(CTM,1), Color.GREEN);
# End Code CTM
 
thanks for that. i guess what i'm (also) asking is this. on a chart, i can only get the correct CTE readings if i set it to 1 year / 1 day. but that's often too many days on the screen for my poor eyes. so i was looking for a way to still get the proper reading but only have 3 months up on the screen.

over at stockcharts, i can set the range for anything i want -- 1 month, 1 year, makes no diff -- and i still get the same CTE score.

am i being clear as mud or should i add some photos?
 
thanks for that. i guess what i'm (also) asking is this. on a chart, i can only get the correct CTE readings if i set it to 1 year / 1 day. but that's often too many days on the screen for my poor eyes. so i was looking for a way to still get the proper reading but only have 3 months up on the screen.

over at stockcharts, i can set the range for anything i want -- 1 month, 1 year, makes no diff -- and i still get the same CTE score.

am i being clear as mud or should i add some photos?
The place where the actual code is at Stockcharts is Static. Unfortunately, I'm not able to work with the code. Feel free to mess with it.
Maybe someone here could help? I would appreciate that also. Remember, ToS code is its own language and some things weren't thought of for inclusion. The Unemployed Russian scientists did the best they could, which was a lot back when they started to code the original program. ☺
 
Below is the chart setup for ThinkorSwim inspired by IBD (Investor's Business Daily) stocks chart. Also, a watchlist column and the Relative Strength (RS) indicator.

Updated 9-5-19

In this shared Google Drive are 2 files: https://drive.google.com/drive/folders/13XOHAGuDNjx6k98U5VB8AL2TmQOjyQqS?usp=sharing
  • A file comparison of yesterdays IBD Relative Strength direct from IBD, along with a listing of what the watchlist code reads for the same security. If you follow the stocks in IBD's 85-85 list, my hope is that you would find most of them ranked above 70 in the watchlist column.
  • The picture is of the watchlist code on the right on my screen shot of the same NASDAQ 100.

IQTO7g2.png


Here's the Code to put in a Custom Watch List Column:
Ruby:
#uTS Watchlist Code for %52WkRng
#Mobius© WLC Percent Inside 52 Week Range

def h = highest(high, 252);
def l = lowest(low, 252);
def x = (close - l) / (h - l);
plot r = round(x * 100, 0);
AssignBackgroundColor( if rs > 80 then color.dark_green else
                       if rs > 60 then createcolor(0,175,0) else
                       if rs > 40 then color.gray else
                       if rs > 20 then CreateColor(220, 0,0) else
                       if rs <= 20 then CreateColor(150, 0,0) else
                       color.white  );
Shared Watch List Link: http://tos.mx/9VSRMyw
Click here for --> Easiest way to load shared links
Use whichever you would like! :)

Below is a scan that I came across that will pull the top 20% of Relative Strength stocks in a Scan of the S&P 500. After loading the scanned list, most were above the 75% line for the above chart's RS line. I also changed the inputs to 0 & 20 and the RS line on this chart was down on all on the list. I suggest scanning in S&P 100 or 500 to keep your list manageable. My thanks to Chris Baker.

Code:
# Scan - Price Rank in Range 80-100
# Edited by Markos to prove out scan for Relative Strength - Use is set for 1Yr-1Day Chart
# This Scan Tab study finds stocks whose price is in the given Price Rank (Price Percentile)
# in the given number of bars.
# By Chris Baker <[email protected]> @ChrisBaker97
# Latest version maintained at: https://bitbucket.org/ChrisBaker97/thinkscript/src/
# This thinkScript is designed for use in the Scan tab. Detailed
# instructions may be found at: https://bitbucket.org/ChrisBaker97/thinkscript/
#
# This work is licensed under the Creative Commons Attribution-ShareAlike
# 3.0 Unported License. To view a copy of this license, visit:
# http://creativecommons.org/licenses/by-sa/3.0/deed.en_US

#Start Code
input period = 252;
input prLo = 80;
input prHi = 100;

def hi = highest(high,period);
def lo =  lowest(low,period);
def range = hi - lo;

def priceRank = 100 * (open - lo) / range;

plot inRange = prLo <= priceRank and priceRank <= prHi;
#End Code

Grid chart: https://tos.mx/hfEeqh

Relative Strength (RS) Line

BhFJjJ9.png


Code:
# Plot the Relative Strength Line in ThinkorSwim
# Written by: @Diamond_Stocks @RayTL_ - TLScripts
# Site:     https://www.traderlion.com/ https://www.traderlion.com/tl-scripts/
# V1

# Declare Lower Places a study on the lower subgraph. This declaration is used when your study uses values that are considerably lower or higher than price history or volume values.
declare lower;

# User Inputs
input show_RSNHBP = yes;
input show_RSNH = yes;

#Relative Strength Type - Candlestick to be added later.
input graphStyle = {default "Line"};

#3 Month, 6 Month, 1 Year RS
input TimeFrame = {default "Three_Months", "Six_Months", "1_Year"};

#Index SymbolRelation
input CorrelationWithSecurity = "SPX";

#Calculation TimeFrame
def aggregationperiod = AggregationPeriod.DAY;

#Chart Normalized Relative Strength Rating on Last Bar
def isLastBar = BarNumber() == HighestAll(if !IsNaN(close) then BarNumber() else Double.NaN);

#Turn on or off Alerts when cycling charts
input Alerts_On = yes;

#Add Chart Bubbble to Graph
input RS_Rating_ChartBubble = yes;

#Establish look back length:
def Length = if TimeFrame == TimeFrame.Three_Months then 63 else if TimeFrame == TimeFrame.Six_Months then 126 else 252;

#Get Index Close/Open/High/Low - Prep for Candlestick RS.
def indexopen = open(CorrelationWithSecurity, aggregationperiod);
def indexhigh = high(CorrelationWithSecurity, aggregationperiod);
def indexlow = low(CorrelationWithSecurity, aggregationperiod);
def indexclose = close(CorrelationWithSecurity, aggregationperiod);

#Get Relative Strength - Prep for Candlestick RS.
def RSopen = open / indexopen;
def RShigh = high / indexhigh;
def RSlow = low / indexlow;
def RSclose = close / indexclose;

def barCount = IF !IsNaN(close) THEN IF IsNaN(barCount[1]) THEN 1 ELSE barCount[1] + 1 ELSE barCount[1];

#Normalize Relative Strength
def newRngMax = 99; #Maximum normalized value
def newRngMin = 1; #Minimum normalized value

def HHDataclose = HighestAll(RSclose);
def LLDataclose = LowestAll(RSclose);
def HHDataopen = HighestAll(RSopen);
def LLDataopen = LowestAll(RSopen);
def HHDatalow = HighestAll(RSlow);
def LLDatalow = LowestAll(RSlow);
def HHDatahigh = HighestAll(RShigh);
def LLDatahigh = LowestAll(RShigh);

def normalizeRSclose = ((( newRngMax - newRngMin ) * ( RSclose - LLDataclose )) / ( HHDataclose - LLDataclose )) + newRngMin;
def normalizeRSopen = ((( newRngMax - newRngMin ) * ( RSopen - LLDataopen )) / ( HHDataopen - LLDataopen )) + newRngMin;
def normalizeRShigh = ((( newRngMax - newRngMin ) * ( RShigh - LLDatahigh )) / ( HHDatahigh - LLDatahigh )) + newRngMin;
def normalizeRSlow = ((( newRngMax - newRngMin ) * ( RSlow - LLDatalow )) / ( HHDatalow - LLDatalow )) + newRngMin;

#Chart RS Line and set appearence:
plot RSLine = RSclose;
RSLine.DefineColor("Positive", Color.UPTICK);
RSLine.DefineColor("Negative", Color.DOWNTICK);
RSLine.SetLineWeight(1);
RSLine.AssignValueColor(if RSLine[0] > RSLine[1] then CreateColor(43, 152, 242) else CreateColor(227, 88, 251));

#Get Highest RS Value
def highestRS = Highest(RSclose, Length);

#RSNHBPCondition
def RSNHBPcondition = if RSclose >= highestRS and close < Highest(close, Length) then highestRS else no;

#Plot RSNHBP Condition
plot RSNHBP = if show_RSNHBP and RSNHBPcondition == highestRS then highestRS else Double.NaN;

#Plot RSNH Condition
plot RSNH = if show_RSNH and RSNHBPcondition == no and RSclose == highestRS and isLastBar then highestRS else Double.NaN;

#Appearance Settings
RSNHBP.SetPaintingStrategy(PaintingStrategy.POINTS);
RSNHBP.SetLineWeight(2);
RSNHBP.SetDefaultColor(CreateColor(196, 94, 225));
RSNHBP.HideBubble();
RSNH.SetPaintingStrategy(PaintingStrategy.POINTS);
RSNH.SetDefaultColor(Color.GREEN);
RSNH.SetLineWeight(2);
RSNH.HideBubble();

#Add Chart Bubble for RS Rating
AddChartBubble(RS_Rating_ChartBubble and isLastBar, RSclose, "RS: " + Round(normalizeRSclose, 0),  Color.WHITE, no);

#Add Label
AddLabel(yes, Concat("Relative Strength: ", Round(normalizeRSclose, 0)), CreateColor(43, 152, 242));

#Alert Capability
Alert( if Alerts_On and RSNHBP then yes else no, "Relative Strength Line New Highs Before Price", Alert.BAR, Sound.Ding);
Alert(if Alerts_On and RSNH then yes else no, "Relative Strength Line New Highs", Alert.BAR, Sound.Chimes);
can some turn this into a watch list label that turns color when when NHBP, a different color when NH? this would be a nice feature when looking at your watch list to know if a stock thats breaking out is also making a new RS high!
 
can some turn this into a watch list label that turns color when when NHBP, a different color when NH? this would be a nice feature when looking at your watch list to know if a stock thats breaking out is also making a new RS high!
Scripts that contain "aggregationPeriod" are limited to providing plots on charts.
The ToS platform does not support the use of multiple timeframes in Scans, Watchlists, Chart Alerts, Conditional Orders.
 
This info might be helpful to some...The FFTY full Prospectus provides the some scan criteria that might be helpful and high-level statements on how the IDB index is formulated and the IBD proprietary Ranking system. According to the doc, stock selection begins with the Eligible Universe of stocks (NYSE, NASDAQ, NYSEA) and then eliminates "under qualified" stocks through criteria listed below, which results in their Selection Universe. Additional elimination criteria is then applied according the Prospectus.

To find this information, login to TD Ameritrade site > Research > ETFs > search for FFTY (Innovator IDB 50 ETF) > click Prospectus link > full Prospectus, > browse to Index Information section): https://prospectus-express.broadridge.com/summary.asp?doctype=pros&clientid=amtd&fundid=45782C102

Index Information

The Index is owned and operated by Investor’s Business Daily®. IBD is not affiliated with the Fund, Innovator or the Distributor. The Fund is entitled to use the Index pursuant to a sublicensing arrangement with Innovator, which in turn has a licensing agreement with the Index Provider. Thomson Reuters serves as calculation agent for the Index (the “Index Calculation Agent”). The Index Calculation Agent is responsible for the management of the day-to-day operations of the Index, including calculating the value of the Index every 15 seconds, widely disseminating the Index values every 15 seconds and tracking corporate actions, some of which result in Index adjustments.

Index Composition

Eligible Universe
. The Index Provider begins component selection from an eligible universe of approximately 7,000 securities that trade on the New York Stock Exchange, The Nasdaq Stock Market LLC or NYSE American LLC.

Selection Universe. Securities are further narrowed into a “Selection Universe” by excluding those not meeting the following criteria:
Minimum price of $15;

Minimum volume criteria of 300,000 shares average daily trading volume;

Security is within 35% of its 52-week price high;
Security is within 15% of its 50-day moving average;

Stocks are also removed from consideration if they show the following qualities:

Security is part of a merger or tender cash offer; or

A break more than 1% below the 10-week moving average on trading volume more than 40% heavier than its average weekly trading volume.

Further narrowing uses proprietary topping classifications to disqualify securities from consideration using a combination of the following metrics in price action:

Percentage changes of weekly closes from the prior week over the last 18 weeks;


Percentage difference between low and high in a given week over the last 18 weeks;


Percentage change of the weekly closing price above its 10-week price moving average in last 18 weeks;


Excessive percentage moves in the average weekly closing price over the last 10-weeks (6% or more);


A high number of days with a positive percent change in price from the previous day over a 14-day period (7 or more);


A high number of weeks with a positive percentage change versus the previous week over an 8-week period (6 or more);


3 or more consecutive weeks with a positive percentage change in a row; and


Gaps up in price where the low is higher than the previous day’s high.


...hope this helps.
 

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