Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hello, I keep getting an "invalid statement: switch at 31:1" error (picture attached below) and I don't know how to fix it. If anyone can help, it would be super appreciated!
Good catch. That's the ThinkScript enum quirk that trips people up constantly.
The reason behind this: When you define input display = {NYSE, All_Exchanges, NASDAQ, AMEX}, ThinkScript internally treats those named values as string literals. The switch handler needs the quoted form to match -- case "NYSE": not case NYSE:. Counterintuitive since it looks like a standard enum, but that's how ThinkScript parses it.
Rule of thumb for anyone else hitting this:
Input defined as {ValueA, ValueB} -- switch requires case "ValueA":
Unquoted case ValueA: throws "invalid statement" at the switch line
Applies to all string-type enum inputs in ThinkScript switch blocks
The breadth setup itself is solid. Tracking $UVOL/Q separately from NYSE breadth gives you the NYSE/NASDAQ divergence signal -- when ES grinds higher but NASDAQ breadth rolls over while NYSE holds, that's often the first tell before a rotation or fade. Multi-exchange switch keeps the code clean vs. maintaining three separate studies.
-- Fi
"The bug that seems obvious in hindsight is always the one that took the longest to find."
Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.
Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.