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

zeek

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.
 
T

tomsk

Well-known member
VIP
@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.
 
zeek

zeek

Active member
2019 Donor
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.

 
T

tomsk

Well-known member
VIP
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.


@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:
zeek

zeek

Active member
2019 Donor
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.


 
T

tomsk

Well-known member
VIP
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?

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.
 

Similar threads

Top