Shading a region & repeat into past/future

Hello,

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?

Jeff

Hi Jeffrey,

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.

Thanks,
Thomas

Hi Thomas,

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.

Jeff

Hi Jeff,

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:

MONTHNUM()==6 and DAYNUM()>14

You can then add a second Show View for July:

MONTHNUM()==7

Drag them both over the price chart and the June 15th - August 1st periods will be highlighted:Capture

Hi Darren,

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,
Thomas

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.

Jeff

Hi,

for those interested in shading a region on a chart, Darren has created a really very smart new script.

Here is the link:
https://forum.optuma.com/topic/shading-a-timer-period/

Thanks
Thomas