Labels for 30days, 180days, 52 weeks and 3 year highs

zeek

Active member
2019 Donor
I am looking chart labels that shows me the price highs of last 30 days, 180 days, 52 weeks and 3 years. So a total of 4 labels.
 
@zeek Here are the labels for the first 3 periods you were looking for. It shows the same numbers if I load this up on /ES, interesting!

Code:
AddLabel(1, "High Last 30 Days = " + Highest(high(period = AggregationPeriod.Day),30), Color.Yellow);
AddLabel(1, "High Last 180 Days = " + Highest(high(period = AggregationPeriod.Day),180), Color.Yellow);
AddLabel(1, "High Last 52 Weeks = " + Highest(high(period = AggregationPeriod.Week),52), Color.Yellow);

For the 4th period I suppose one way might be to look at the highest high in 52 * 3, or 156 Weeks. However make sure you have sufficient data on your chart or it won't give you the results you seek.
 
Perfect! Thanks you so much @tomsk (y)

Another question for you @tomsk , i noticed that the 30 days and 180 days labels will also work on lower timeframes. For example, i can see the levels on a 2d 5m chart as shown in the pic below but it only seems to work in regular hours. I had the study on my chart in pre-market this morning and the labels did not show anything but as soon as market opened, the price was there.

Is there a way to make the price levels also show in pre-market? This would be very useful to have.

HMpQmhN.png
 
@zeek Since I have accessed the data using a daily aggregation, this would work on aggregation periods lower than daily, e.g. 30 min, 15 min, etc. It is after hours now, the market is closed and the labels that I posted above works on a 5 min aggregation of AAPL.

Edit Update: It is now 8:05 am Eastern - Display is a bit odd on AAPL on an intraday chart. Not sure why. There are no issues on a daily chart though
 
Last edited:
Ok, so i noticed something else that i wanted to ask you about. Take a look at the two charts below with symbol AWSM, one is a 180 days hourly and the other is a 1 year daily chart. On the hourly, the high is 121,06 but on the daily, it shows a high of 109,94 for the same period (which is also what the label says).
So it seems that the daily and hourly have different ways to determine the high of same time period. Why is that?

And this brings me to my next question, is there a way to show the high prices in the labels just like in the hourly chart i posted?
I can manage without the 52 week highs so 30 days and 180 days is all i need for the labels but it`s important that they show the "real" highs.

gwZK2nH.png


lFXJ57E.png
 
@zeek A couple of things - Firstly you have the incorrect ticket listed above - it should be AXSM rather than AWSM. I'm pointing this out here for the benefit of other readers.

Now if I load the study from post #2 onto a daily chart, or even an hourly chart, I see the exact same number displayed for 30 days, 180 days and 52 weeks - 109.94 - that number is consistent on the daily, hourly, all the way down to 5 min.
 
Great.

My requirement is that while my chart period is 1d 1m, on this chart I want to show 52 week High and 52 Week Low. Is there a workaround to get this done? I see message above that if chart is for a less than a year, I won't be able to see 52W high and low.

Any help will be appreciated. Thanks in advance.
 

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