August 29, 2020 at 12:59 pm #59717
Is there a tool or a way to code a show view that would highlight a time region on a chart (ex: June 15 – August 1st) and could repeat this shading into the same region in the future and/or past?
JeffSeptember 1, 2020 at 6:38 am #59743
that is a really interesting question.
Making your question a little bit easier: Is there a way to create a script that highlights/shades a specific time period e.g. 5/12/2020 to 8/17/2020?
I understand that it is necessary to manually input the dates in the script but having a script would place the highlighted period exactly at the entered dates.
Currently I use the “Date Region” tool to do the job. That works fine, but having a script would be better. In some way the script would look like the US recession periods using the recession file from the FRED to highlight US recessions but instead of having a file to highlight the specific time period it would be done with a script.
A great additional feature would be to display the dates when the highlighted time period begins and when it ends.
ThomasSeptember 1, 2020 at 10:31 am #59745
Thank you for sharing how you use the “Date Region” tool; this is very handy actually. Everyday I am learning something new here! Amazing software.
The idea of repeating a shaded region in the past for me would allow a simple way to visually confirm specific areas for seasonal strength or weakness in the annual cycle or perhaps a 4 year presidential cycle, etc.. and having ability to repeat in future would allow for a heads up.
I see what you are saying about coding to define exact dates – perhaps there is a way to do this.
JeffSeptember 3, 2020 at 9:10 pm #59799Darren
- Topics: 62
- Replies: 521
- Posts: 583
It’s a bit tricky but you can use the MONTHNUM() and DAYNUM() functions. There may be a more elegant way to do it, but the following in a Show View will highlight June 15th to the end of the month:123MONTHNUM()==6 and DAYNUM()>14
You can then add a second Show View for July:123MONTHNUM()==7
Drag them both over the price chart and the June 15th – August 1st periods will be highlighted:September 4, 2020 at 6:27 am #59807
a nice trick. I did not believe that it is possible.
Adding the YEARNUM() function and you can shade any single period in the past.
But interestingly the “shaded bars” have a fixed width. To cover/shade a periods of a few months you have to add a few Show View scripts to shade the whole period of a few months.
On the other hand if you want shade a period that is smaller than the fixed width of the “shaded bar” this would not be possible.
Is there a way to change the “shaded bars” fixed width. Unfortunately the function “Line Width” has no effect.
Last but not least would it be possible to add in v1.7 a new tool that can shade a user specified time period by entering the beginning and ending period and the time between the two dates would be shaded?
The new tool should be able to shade a specific time period as well as should be able to repeat the same time period each year to have the seasonality shading as Jeff has described and you have shown in your chart.
Thanks a lot Darren,
ThomasSeptember 4, 2020 at 12:40 pm #59817
Thanks Darren – this is a handy to known how to do! Thank you for explaining. The only thing, it does not project into the future, but I can use Date Region for future regions for now.
JeffNovember 4, 2020 at 3:46 am #60793
- You must be logged in to reply to this topic.