Thinkorswim Scan Relative Strength 49

Custom Scan Using a Corrected Relative Strength Study

Thinkorswim Scan Relative Strength

Thinkorswim Scan Relative Strength

Quickly find stocks that over-perform or under-perform an index. This video shows how to configure a custom scan in Thinkorswim using an improved Relative Strength study. Use recent market turning points as your start date. The scan will compare stock performance from that date forward. Easily find stocks that are trending stronger or weaker than the index. Catch stocks as they make their first transition from under-perform to over-perform. Find out where the big money is reallocating their holdings.

Markets go through cycles, and during transitions the old leaders are replaced by new ones. This scan will help you spot those stocks which are in the process of that transition. Free custom code is included. The clickable link is embedded directly in the video. Be sure to not to miss it.

Link to study file: Scan_RelativeStrengthSTUDY.ts


*Thinkorswim is a chart analysis platform offered by TD

TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.

Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.

Here is the code used to create your own custom watchlist columns as demonstrated in the video below.

Watch the video, Thinkorswim Scan Relative Strength below:

Questions? Comments? Post a review?

49 thoughts on “Thinkorswim Scan Relative Strength

    • Pete Hahn Post author

      The screenshot does not help in this case. This error message has been reported by some viewers on our YouTube channel. It does not happen for all users of Thinkorswim and the issue only started recently. Your screenshot does not show which top level filters you have applied to the scan (that was the most important detail you should have included in your screenshot). I suggest you apply some top level filters that are appropriate for this scan. For instance if you are using the ticker symbol “SPX” for the user input named “CorrelationWithSecurity”, your top level filter should be the stocks of the S&P 500 index. Since your error message contains a Forex currency pair I can only suggest that you have failed to setup the appropriate top level filters for your scan. If this does not resolve the issue you will need to contact support at TD Ameritrade because the problem is likely something that needs to be corrected on their servers.

      • Imani

        Thank you so much! I was able to succesfully correct it by scanning through the s&p500 filter.

  • vic thompson

    Hey Pete,

    Instead of inserting the date into the scan script as you detailed in your video, can’t we just set the start date through the chart settings (time frame-custom) which will become the reference point for the study?

    • Pete Hahn Post author

      You can do that on the chart, yes. But it is impossible to do that for the scan. Which is the only reason the start date was added. I am pretty sure I explained that early on in the video though.

      • vic thompson

        Understood and thanks for getting back to me on this Pete. My apologies for sending you my other question via email, just let me know how I can include screenshots which should make my request/inquiry a bit simpler I believe.

      • Pete Hahn Post author

        If you need to provide screenshots the place to request assistance is in the Q&A Forum. Please check that you have set the date exactly the same for both the chart and scan and make sure both the chart and scan are set to the same exact time frame. This will only work on Daily time frame or higher. There is very little that can go wrong so the only possible reason you are not getting correct results is because your settings are not correct.

      • vic thompson

        Thanks again for this response: I’ll check again to make sure before going through the QA forum.

      • vic thompson

        Thanks again for this information. I’ll be sure to take this start date information into consideration when re-running everything later this afternoon.

  • xiangjn

    Thank you. It is very useful to consider different timeframe. Sometimes, we have situation there are multiply options with different strike price, we have a little problem to select one. Can we scan options according to the difference between strike price + option price and stock price?

    • Pete Hahn Post author

      That question is totally outside the context of this video. I suggest you search our Q&A Forum to see if someone has already posted a question similar to this.

  • chris

    Can this work on Intraday Basis? I am getting weird results if the date happens to be today and i am using 15 mins in the study scan. Please let me know if i am doing wrong. Thanks for sharing the indicator.

    • Pete Hahn Post author

      This was never intended to be used on any intraday time frame. I can’t imagine a case in which using an intraday time frame for relative strength would even be useful.

  • John Morgan

    Pete you are a true master and your guidance is helping me to be a better trader by letting Thinkorswim do the heavy searches for me.
    My question is can you use any prior date to correlate with. You used 10150428, but it is 2021 now, so can I use a date say 20200410? Also you used the SPX to intersect with the S&P 500, can you use all stocks if I am trying to find stocks that are doing better than the SPX or do you need to select with the S&P 500?

    • Pete Hahn Post author

      The date can be set to any date in which the stock markets were open for regular trading. You can use whatever ticker symbol you want for the “Correlation With Security”, and apply that any list of stocks you want to use. There are no rules here. Only suggestions.

  • Sam

    Found my mistake finally, after dinner. In the SCAN tab, it sets by default to “SHOW 50 OPTIONS” and i had to change it from options to “STOCKS” in the dropdown menu. I kept looking into the code, rather than checking the items in scan tab.

    Now, if only there was a way to setup the scan to point to the STUDY we created, it would be lot easier to change the parameters in SCAN editor, rather than going into the code each time, and changing the PLOT choice for each scan i want to do.

  • ajay sagar

    Fantastic Video Pete. Question – how can you add a filter to look for stocks that are in 90 percentile on the relative strength as well as trending stronger than the index?

    • Pete Hahn Post author

      “90 percentile” implies a range of values. What you are describing then is something that looks back a specified number of bars, finds the highest and lowest value and then checks if each stock is currently in the top 10% of that range. Far more complex than we can solve in the comments section of a video.

  • Andrea

    Hello Pete,

    I cant believe just today I learnt about your great website! Congratulations!
    I tried to use paste the SCAN RELATIVE STRENGHT code in the thinkScript editor and the message I receive is:
    “Exactly one plot expected”
    Are you aware of what can be causing this issue?
    Thank you and regards,


    • Pete Hahn Post author

      Make sure you did not skip any portions of the video. The code was designed as a chart study and in the video I explain the changes required to make it work as a scan.

      • Andrea

        Thank you very much and sorry if the excitement of the discovery made me jump one whole step! 🙂

  • Kristina Shinkar

    Hi Pete,

    is it possible to change the timeCondition in AddChartBubble ( boolean time condition, double price location, Any text, CustomColor color, boolean up); to take a range, to have referenceStartDate and referenceEndDate? and if so, how can i accomplish that.

    Thank you.

    • Pete Hahn Post author

      Well beyond the scope of what we can address in the comment section of a video. Please check the Q&A forum to see if your question has already been solved and if not then post this as a new question.

  • Douglas Nashif

    Hi Pete, I’ve been wanting to tinker with this one for awhile. Today I have successfully created scans that are synchronized with the studies on my charts. I am wondering if you have created watchlist columns along the way? It would be great to have a “rsi crossover” colored box and a “stronger than” colored box next to the symbols in my watchlist. Let me know please and if you have not created them but could build them for me that would be great! Doug
    P.S. Just want you to know… I did attempt to massage the script for a column but honestly I’m pretty miserable at this thus reaching out to you.

  • Richard A. Huber

    I am Having trouble withthe Relative Strength Scanner. When I tried to access the Scan_realtive strength Study.tx I cannot get it to open.

    I have copied the code from the video but it is not working?? any advise


  • Chad

    For some reason, I can’t get this scan to work. I’ve tried everything I can think of. I’ve compared the code that I’ve got to what you are showing in the video. I can’t see any differences. I’ve tried different dates and indexes, and I always get “No Matching Symbols”. I don’t want to post the code to the scan on here, because I know you want it in the video so people will watch the video and learn to use it correctly. Do you have any thoughts on what I could be doing wrong – or can I send my scan code to you and have you glance over it?

      • Chad

        CorrelationWithSecurity is SPX – and I’m intersecting with S&P 500 (I’ve also tried the nasdaq and russel 2000 like you did on your video)
        referenceDate is currently set at 20180128 (but I’ve tried several other dates as well)
        The time frame that I’m using is “Day”

      • Pete Hahn Post author

        First thought is your date. The date must be a day the markets were open for trade. Did I not mention that in the video? The date you have selected is a Sunday. Change to the 26th and see if that corrects the issue.

      • Chad

        You probably did mention that in your video, and I just missed it. Changing the date to 20180126 did not make a difference though.

      • Pete Hahn Post author

        I see that. There something wrong with the scan engine. It is literally broken. Try “plot scan = close > 0;” and you get zero results. This happens from time to time. I usually report it to Thinkorswim support when I find it has broken like this.

      • Pete Hahn Post author

        You are very welcome. I have just submitted a support ticket on this issue. Hope they get it fixed quickly.

      • Don

        Great scan concept…just what I am looking for…but it appears that the code is still broken from TOS like so much of the platform….have you updated the thinkscript recently…thank you

      • Pete Hahn Post author

        “appears that the code is still broken”…. “like so much of the platform”??? I have no clue what you are talking about. If you provide details perhaps I can clear things up. Nothing broken in this code. Post in the Q&A forum if you need assistance. Search first to see if your question has already been addressed.

  • Tyler

    Hi Pete, great work as always! The code for the relative strength scan does not appear to be posted on this page. Can you please upload the code? Thanks!

    • Pete Hahn Post author

      Instructions are given within the video description: “Free custom code is included. The clickable link is embedded directly in the video. Be sure to not to miss it.”

      The vast majority of our free indicators are provided in this manner. Very rarely will you find code posted directly on the web page.