Recession bars

I am hoping to recreate the grey bars seen in Fred where the Fed marks recession dates with grey bars. I think there should be a way to do this. My first guess was to the BarDate function but the bars show "position" instead of bar date as shown here, https://help.optuma.com/kb/faq.php?id=922. And, the numbers in position seem to be the number of bars in the history of the code. Is there a simple way to create grey bars, for example, covering the area from Dec 2007 to June 2009 and then have that script available as an indicator? Ideally, I'd like to have a function called "recession" and when I add that it highlights the dates on any code showing all recessions since 1899 or however long the security has been traded.

 

Thank you, Mike

Hi Mike,

If you have the FRED exchange enabled already you should have access to a tool called Recession that already achieves the result you’re after:

https://help.optuma.com/kb/faq.php?id=987

 

That is the exact tool I was looking for and it is amazing. It has data for other countries and two versions for the US.

Thank you, Mike