AddChart: How to Superimpose A Second Chart on Your Main Chart in ThinkOrSwim

Headhunter20

New member
An old platform I used allowed me to accidently put a daily price bar on top of a Heiken Ashi candle. I noticed that when the bar close price was above the Heiken Ashi center line the price was going up and when the price was retracting to below the candle the price was pulling back. Bar price in the candle upper half indicated the price was consolidating but with an upward breakout direction ..... in the lower half price was consolidating but indicating a breakout lower. Has anyone, or can anyone figure out how to put a price bar on top of a Heiken Ashi candle in think or swim. I have contacted the ThinkOrSwim help desk and they say it can't be done.
Any Help? Thank you.
 
It's a long since deprecated function, but there is an add chart function. It may not be supported in future versions, so don't come to rely on it necessarily:
Code:
declare upper;

def h = HIGH;
def L = LOW;
def c = CLOSE;
def o = OPEN;

AddChart(high = h, low = L, open = o, close = c, type = ChartType.bar , color.light_Gray);
I'm sure I'm missing a few colors in there, but you can only draw one colour anyway. (unsupported function don'cha'kno? -- the workaround is a laborious process of plotting several AddCharts, but there is another thread about that. Set your color as needed.

Set your normal chart to Heikin Ashi, and add this as a study.

-mashume
 
Last edited:
What would be the code to superimpose a second chart as a line chart over your main TOS chart? I have a reference here: Second Chart.

Naturally, being able to quickly reference a second asset, like the SPY, can help you predict where your main chart is heading. For example, if an asset trends upward while SPY is flat, then seeing SPY start uptrending may signal a continued uptrend in the stock you're watching. Or if an asset uptrends along with SPY, then SPY starts a downtrend while your stock continues heading upward, that divergence suggests that buyers are truly in control of the stock you're watching.

But how would you superimpose the SPY on your main chart? It would be easier to track that than watching the RelativeStrength indicator as a lower study.
 
This was just asked here:
https://usethinkscript.com/threads/...ond-chart-on-your-main-chart.9432/#post-85172

you can change the addChart chart type to .CANDLE or other things as you need. Colouring it is another matter. There are threads about it around.

You'll probably want to make sure it's plotting on the left axis. Unless it's within a few (very, very few) points of whatever instrument is on the chart.

Happy Trading,
-mashume
 
Last edited by a moderator:
Another option

Sfi5q71.png
 
As an alternative, how about running any average (simple, exponential, etc.) with a setting of 1, based on close? That should give you a tracer across each candle position. I realize it isn't exactly what you wanted, but perhaps it would be better than nothing.
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
286 Online
Create Post

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