Alternative to Comparison Charts

Mordoor

New member
2019 Donor
Here is a chart I like to keep an eye on during the day which combines many things into one. The upper is VIX in purple and SPX in cyan. Lower study is the NYSE using Ben Tens simple tick. I have overlayed the XLK onto the TICK using a comparison chart. I would like the aggregation for the XLK to start the same as the TICK. However, there is no way to see the code for the comparison chart as TOS does not make it available, it is hidden. So I am wondering if there is a way to overlay XLK onto the TICK study without using a comparison chart and to have the aggregation start at market open just like the TICK. Also have aggregation in the price area of the chart where VIX and SPX is to also start aggregation on market open. I know if I set the chart to TODAY it will start to aggregate at open, however, it takes a few hours for it to build out into something useful.

If you scroll back in time on this chart you will see XLK moving up or down and that is the problem I am trying to figure out. Here is link to TOS chart: http://tos.mx/gfZgx4O

uzLJTxN.png
 
Solution
Add this code to the bottom of your TICK indicator:
Code:
input secondary_multiplier = 250;
def xlk = close(symbol = "XLK");
def secondary_standoff = if barNumber() == 1 or NewDay then xlk else secondary_standoff[1];
plot secondary = (xlk - secondary_standoff) * secondary_multiplier;

This resets the XLK line at zero at the start of each NewDay. If that's not what you want remove the or newDay bit of the code and it will pin the first bar to the zero mark. You may have to play with the secondary_multiplier to get a plot you're happy with. This does not plot the actual XLK values, they're in far, far to narrow a range to be useful, thus the zero-adjusted and multiplied version in the plot.

-mashume
Add this code to the bottom of your TICK indicator:
Code:
input secondary_multiplier = 250;
def xlk = close(symbol = "XLK");
def secondary_standoff = if barNumber() == 1 or NewDay then xlk else secondary_standoff[1];
plot secondary = (xlk - secondary_standoff) * secondary_multiplier;

This resets the XLK line at zero at the start of each NewDay. If that's not what you want remove the or newDay bit of the code and it will pin the first bar to the zero mark. You may have to play with the secondary_multiplier to get a plot you're happy with. This does not plot the actual XLK values, they're in far, far to narrow a range to be useful, thus the zero-adjusted and multiplied version in the plot.

-mashume
 
Solution

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

Add this code to the bottom of your TICK indicator:
Code:
input secondary_multiplier = 250;
def xlk = close(symbol = "XLK");
def secondary_standoff = if barNumber() == 1 or NewDay then xlk else secondary_standoff[1];
plot secondary = (xlk - secondary_standoff) * secondary_multiplier;

This resets the XLK line at zero at the start of each NewDay. If that's not what you want remove the or newDay bit of the code and it will pin the first bar to the zero mark. You may have to play with the secondary_multiplier to get a plot you're happy with. This does not plot the actual XLK values, they're in far, far to narrow a range to be useful, thus the zero-adjusted and multiplied version in the plot.

-mashume
Thanks for the response. However, since XLK is not plotted inside of the code for the $TICK, it does not produce the same as overlaying a comparison chart of the XLK that uses the left axis. I need the full range of the left axis for XLK. I have been trying to create a simple chart that plots in the lower panel such as this:

input symbol = "XLK";
def symbolSeries = close(symbol);
plot SymbolSeriesPlot = symbolSeries;

What I am having trouble with is getting it to start at each new trading day instead of continuing from day to day.
 
Thanks for the response. However, since XLK is not plotted inside of the code for the $TICK, it does not produce the same as overlaying a comparison chart of the XLK that uses the left axis. I need the full range of the left axis for XLK. I have been trying to create a simple chart that plots in the lower panel such as this:

input symbol = "XLK";
def symbolSeries = close(symbol);
plot SymbolSeriesPlot = symbolSeries;

What I am having trouble with is getting it to start at each new trading day instead of continuing from day to day.
You need to open up the code for the $TICK indicator you're using (I did from your shared setup) and ADD the code I posted to the bottom of the indicator code. Do not use it as it's own indicator. That way it will not move around and will reset to zero every day.

-mashume
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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