Local variables and performance


New member
In this code from BenTen:
def vHigh = high;  # creates the variable vHigh.  Use of the variable reduce data calls to tos iData server

Is this known to improve performance and reduce calls to the server?
Is there any other benefit for creating a local variable other than reducing server calls (like reducing variable lookups)?

The variable itself is used both for a single last value and as an IDataHolder when aggregated, such as highest(vHigh, n).

Does the script actually loads the IDataHolder for the entire chart once per render? What happens when a new bar arrives?

Which IDataHolders benefit from it? Do combinations like HL2 also need it, or are they calculated on the client from High and Low?

How does this work when the data holders are used with parameter, like high("SPX")?
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
Ramisegal Backtesting strategy report results and performance score Playground 1
J Studies Performance Tips & Tricks Playground 1

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
361 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.