Custom Study Lookback (data prior to chart period)

Wolfenstein

New member
Hi all! So, I've created a custom study/indicator that I really like based on one found on TradingView. I couldn't find said indicator on here in thinkscript, so I did the translation myself. Got it working, all is good on that front.

However, I want to use the output from said indicator in a second-level custom indicator. I've got certain aspects of it working (anything calculating based on the data in the chart period). But I'm having trouble getting data from before the chart period to be calculated by my copy/pasted custom indicator code. And I need access to that data. I.e. if my chart period is 1Y/1D, ideally I would like to be able to look back across 2 years of data for my custom indicator and make a calculation on that entire timeframe.

This works when you're referencing a built-in indicator just fine... I can look back any point in time for RSI (for example) and use that data in my calculation even if the bar number in question isn't within my chart range.

Any help would be greatly appreciated! Thank you in advance!
 
Solution
Hi all! So, I've created a custom study/indicator that I really like based on one found on TradingView. I couldn't find said indicator on here in thinkscript, so I did the translation myself. Got it working, all is good on that front.

However, I want to use the output from said indicator in a second-level custom indicator. I've got certain aspects of it working (anything calculating based on the data in the chart period). But I'm having trouble getting data from before the chart period to be calculated by my copy/pasted custom indicator code. And I need access to that data. I.e. if my chart period is 1Y/1D, ideally I would like to be able to look back across 2 years of data for my custom indicator and make a calculation on...
Hi all! So, I've created a custom study/indicator that I really like based on one found on TradingView. I couldn't find said indicator on here in thinkscript, so I did the translation myself. Got it working, all is good on that front.

However, I want to use the output from said indicator in a second-level custom indicator. I've got certain aspects of it working (anything calculating based on the data in the chart period). But I'm having trouble getting data from before the chart period to be calculated by my copy/pasted custom indicator code. And I need access to that data. I.e. if my chart period is 1Y/1D, ideally I would like to be able to look back across 2 years of data for my custom indicator and make a calculation on that entire timeframe.

This works when you're referencing a built-in indicator just fine... I can look back any point in time for RSI (for example) and use that data in my calculation even if the bar number in question isn't within my chart range.

Any help would be greatly appreciated! Thank you in advance!
https://usethinkscript.com/threads/toggling-signal-line-color.10453/#post-94520
 
Solution

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