Any way to #-out large blocks of code?

floydddd

Active member
often, i want to swap larger piece of code, without losing what i'm swapping out. currently, to hide the old code, i have to place a # in front of every relevant line. seems to me there ought to be an easier way to do it, like, after the #, encapsulating and capturing the rest with parens or brackets, neither of which do the trick, of course. any other shortcut to this that i don't know abut?
 
Not that I know of. Just the slow process of commenting out each line one by one. You could duplicate the script and just delete everything you don't need, but then you will have a bunch of extra studies in TOS if you don't periodically delete them.
 
@floydddd TOS keeps 10 versions of scripts. You can cut whole blocks, add blocks, edit, label the various versions.
m0ysPNF.png
 
wow. did not notice that, merryday. thanks!

pensar: i've got wwwway too many custom studies, a lot of them repeats from when i open a sharing link. will have to go through and get rid of them some day but every time i started, i get overwhelmed and go back and enter a new study just for the heck of it. there's just so many of them to check out. lately, i've been perusing all that's available on github. it's nearly never ending!
 
@floydddd I'm the same - I have over 75 named "newstudy__" alone, and that doesn't count all the custom named ones. I've recently created a OneNote for scripts, and spent a whole day moving them over and deleting the unnecessary ones. I try to clean out my studies about once every 2-3 months.
 
often, i want to swap larger piece of code, without losing what i'm swapping out. currently, to hide the old code, i have to place a # in front of every relevant line. seems to me there ought to be an easier way to do it, like, after the #, encapsulating and capturing the rest with parens or brackets, neither of which do the trick, of course. any other shortcut to this that i don't know abut?
I suggest using a text editor like sublime or vs code. There is even a syntax highlighter for vs code. Anyway, I suggest these because they support the creation of create multi-line carets so you could press # once. There are other benefits, but out of the scope of your question.

If you want to stay in the native editor, you could also encapsulate your code into functions using script. Then you could create different versions of the function and call it from your main code. https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/script.html
 

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