Exclude blank sector results in scan


New member
When I perform a custom scan on stocks I will get many results that have no identified Sector/Industry - it’s just blank when I list Sector/Industry as a column. I would like to exclude these results from the scan process. Does anyone know of a line or two of custom code that would do this?
Though there's not an automated way to exclude those, TOS will do most of the work for you with just a little manual intervention. At the top of the scan window you can select a watchlist of symbols to exclude. Create a new watchlist and set your scan to exclude it. Run a scan that has whatever your minimal criteria for stocks you would trade and set it for 2000 results. Sort by the Sector column. Multi-select the ones with no sector. Copy/paste that to Excel (easiest) or even Notepad. If it's Excel, select the column with all the symbols and copy. Go back to TOS and import those into your exclusion watchlist. If you used Notepad you need to edit every line so it's just the symbol and then copy that and import into TOS.

Presumably as new symbols are created or their parameters change and begin meeting your scan criteria you'll see some without sectors showing up in your scan again. Just right-click them and add to your exclusion watchlist. Note that if you run a scan, see a stock with no sector, add to exclude list, run again immediately it will still be in the results. TOS takes some time before it reads the symbols from the exclusion list again. It'll work later.
@wchillman Here are the top 1000 that I exclude, mostly ETFs. However, there are some futures that I also exclude even though they have a sector.

Watchlist edit allows you to do a mass delete if you don't want to exclude futures (they are sorted to the bottom of the list). HTH



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
200 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.