thinkScript Reference Other Data or Studies

SugarTrader

Member
I'm building my own indicator but I need to reference other custom studies in thinkscript. What would be the function for that? I know it is super easy to define an alert based on condition of 2 or more indicators.

For example, Alert is true if:
  • indicatorA is true AND
  • indicatorB > x AND
  • indicatorC < y
But instead of notification from alerts, I would like to write and indicator/study that will visually place a mark (an arrow for example) on chart while the conditions of my 3 indicators are met. I try writing it but it seems that TOS does not recognized my custom indicators when I want to "call" them. Any idea how to fix it?

Thank you
 
As a scanner, ok. I thought it was possible, somehow by coding into ThinkScript. Thanks

Sure, you can do the same thing from within a Study by using reference... But, as @BenTen referred to, it can be easier to compile the code you would use in a Study from within the Scanner... You could just as easily use the Conditional Editor with the Study Panel but I find it easier to Bounce over into the Scanner, compile the code, and then Copy & Paste it into the Study code... Your choice in how to do it... Most of the time I can just write the reference code by looking up the Study or Function I want to use in the TOS Learning Center...

In everyday coding we do this all the time... For example, ExpAverage(close, 9) is actually a reference to the ExpAverage() function... But SimpleMovingAvg() that you've seen in Studies is actually a reference to another Study named SimpleMovingAvg... Sometimes the word reference is implicit, meaning it doesn't need to be written while other times it is required... One problem to note is that you cannot reference a Non-Licensed Study from within a Study, but you can call them from within the Scanner...

Hope this helps...
 
Last edited:
Sure, you can do the same thing from within a Study by using reference... But, as @BenTen referred to, it can be easier to compile the code you would use in a Study from within the Scanner... You could just as easily use the Conditional Editor with the Study Panel but I find it easier to Bounce over into the Scanner, compile the code, and then Copy & Paste it into the Study code... Your choice in how to do it... Most of the time I can just write the reference code by looking up the Study or Function I want to use in the TOS Learning Center...

In everyday coding we do this all the time... For example, ExpAverage(close, 9) is actually a reference to the ExpAverage() function... But SimpleMovingAvg() that you've seen in Studies is actually a reference to another Study named SimpleMovingAvg... Sometimes the word reference is implicit, meaning it doesn't need to be written while other times it is required... One problem to note is that you cannot reference a Non-Licensed Study from within a Study, but you can call them from within the Scanner...

Hope this helps...
got it, thank you @rad14733
 
How do I reference the DOM in thinkscript?

The only way I currently know how to reference the Bid/Ask of a current candle strick is by

Code:
def ASK = tick_count(priceType = PriceType.ASK , period = AggregationPeriod.FIFTEEN_MIN);
def BID = tick_count(priceType = PriceType.BID , period = AggregationPeriod.FIFTEEN_MIN);

but I would like to pair each Bid or Ask to the price that the limit order is based off of from the DOM

Thanks for anyone that helps!
 
@BenTen you keep referring to license study. if I understand you right, you're referring to all locked study as License studies. also is there a limit to the number that can be referring in a study. Using the RSI study as example, if I want to change the input fast to .26 and slow to .60 and keep the Oversold and bought as is, could and how would I do that. as to reference format
 
@BenTen you keep referring to license study. if I understand you right, you're referring to all locked study as License studies. also is there a limit to the number that can be referring in a study. Using the RSI study as example, if I want to change the input fast to .26 and slow to .60 and keep the Oversold and bought as is, could and how would I do that. as to reference format
https://usethinkscript.com/threads/reference-syntax-and-indicator-settings-in-thinkorswim.5022/
 

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