The short answer is no. I found nothing within the thinkscript language which would allow us to write a custom script to identify US vs Non-US stocks.
However even if this were possible it would not be the ideal solution. Why? Because the scan would still need to churn through and read the country for every stock included in the top level filters. It would not save any processing time.
The best solution is to build your own custom watchlist and apply that as a top level filter. There are three elements in the top level filter to choose from:
- "Scan in:"
- "Intersect with:"
If you create a watchlist containing only those stocks you want to include in the scan, you would apply that to either item 1 or item 2. If you create a watchlist containing all of the stocks you want to omit from the scan, you would apply that watchlist to item 3.
If you want to learn more about how these top level filters work you can view the following video:
The video description on that page includes a topical index so you can jump straight to an item of particular interest. The "Top Level Filter" topic begins at 3:32. I suggest you watch the rest of this video so you will learn how organize your scans to run faster. There are many options in the scan tool on Thinkorswim which most users are not aware of.