Sinuhet

US recessions

324 0 31
Displays US recessions from 1900 - 2014 listed here: http://www.nber.org/cycles.html
Unix timestamp generated using this service: http://unixtimestamp.50x.eu/. For beginn/end of recession always taken the 15th day of the particular calendar month.
Tradingview has a bug by using unix timestamp: I had to add "000.0" to each generated timestamp to display the date in the tradingview correctly. Once the bug will get corrected, this cript will no more work!
The bug is described here: https://getsatisfaction.com/tradingview/topics/unix-timestamp-in-pinescript?utm_source=notification&utm_medium=email&utm_campaign=new_reply&utm_content=topic_link

Unfortunately tradingview does not allow to display any (forecasted) recession into the future and or with later dates then 1900! This is disappointing.

NOTE: I can not code at all. PLEASE modify this script as much as you like. Particular would be helpful, if:
- there is only one background colour to edit
- there are tickboxes, where you can deselect the particular recession with titles of such recessions
- perhaps electively be able to display the title of the particular recession directly on its background within the chart
Remove from Favorite Scripts Add to Favorite Scripts
////////////////////////////////////////////////////////////
// US recessions made by Sinuhet
// Feel free to modify!
////////////////////////////////////////////////////////////
study(title="US Recessions", overlay = true)
Recession0Start = -2123625600000.0
Recession0End = -2063145600000.0
Recession1Start = -1976486400000.0
Recession1End = -1942185600000.0
Recession2Start = -1892160000000.0
Recession2End = -1829088000000.0
Recession3Start = -1797465600000.0
Recession3End = -1737072000000.0
Recession4Start = -1621382400000.0
Recession4End = -1603065600000.0
Recession5Start = -1576627200000.0
Recession5End = -1529366400000.0
Recession6Start = -1471564800000.0
Recession6End = -1434672000000.0
Recession7Start = -1363651200000.0
Recession7End = -1329436800000.0
Recession8Start = -1274227200000.0
Recession8End = -1161216000000.0
Recession9Start = -1029715200000.0
Recession9End = -995500800000.0
Recession10Start = -784944000000.0
Recession10End = -764035200000.0
Recession11Start = -666662400000.0
Recession11End = -637804800000.0
Recession12Start = -519523200000.0
Recession12End = -493257600000.0
Recession13Start = -390614400000.0
Recession13End = -369619200000.0
Recession14Start = -306460800000.0
Recession14End = -280022400000.0
Recession15Start = -1382400000.0
Recession15End = 27561600000.0
Recession16Start = 122256000000.0
Recession16End = 164160000000.0
Recession17Start = 316828800000.0
Recession17End = 332553600000.0
Recession18Start = 364089600000.0
Recession18End = 406252800000.0
Recession19Start = 648086400000.0
Recession19End = 669081600000.0
Recession20Start = 984700800000.0
Recession20End = 1005868800000.0
Recession21Start = 1197763200000.0
Recession21End = 1245110400000.0
Recession22Start = 1427673600000.0
Recession22End = 1469836800000.0
BGColor0 = iff(time >= Recession0Start and time <= Recession0End, green, na) 
BGColor1 = iff(time >= Recession1Start and time <= Recession1End, green, na)
BGColor2 = iff(time >= Recession2Start and time <= Recession2End, green, na)
BGColor3 = iff(time >= Recession3Start and time <= Recession3End, green, na)
BGColor4 = iff(time >= Recession4Start and time <= Recession4End, green, na)
BGColor5 = iff(time >= Recession5Start and time <= Recession5End, green, na)
BGColor6 = iff(time >= Recession6Start and time <= Recession6End, green, na)
BGColor7 = iff(time >= Recession7Start and time <= Recession7End, green, na)
BGColor8 = iff(time >= Recession8Start and time <= Recession8End, green, na)
BGColor9 = iff(time >= Recession9Start and time <= Recession9End, green, na)
BGColor10 = iff(time >= Recession10Start and time <= Recession10End, green, na)
BGColor11 = iff(time >= Recession11Start and time <= Recession11End, green, na)
BGColor12 = iff(time >= Recession12Start and time <= Recession12End, green, na)
BGColor13 = iff(time >= Recession13Start and time <= Recession13End, green, na)
BGColor14 = iff(time >= Recession14Start and time <= Recession14End, green, na)
BGColor15 = iff(time >= Recession15Start and time <= Recession15End, green, na)
BGColor16 = iff(time >= Recession16Start and time <= Recession16End, green, na)
BGColor17 = iff(time >= Recession17Start and time <= Recession17End, green, na)
BGColor18 = iff(time >= Recession18Start and time <= Recession18End, green, na)
BGColor19 = iff(time >= Recession19Start and time <= Recession19End, green, na)
BGColor20 = iff(time >= Recession20Start and time <= Recession20End, green, na)
BGColor21 = iff(time >= Recession21Start and time <= Recession21End, green, na)
BGColor22 = iff(time >= Recession22Start and time <= Recession22End, green, na)
bgcolor(BGColor0, 80, 0)
bgcolor(BGColor1, 80, 0)
bgcolor(BGColor2, 80, 0)
bgcolor(BGColor3, 80, 0)
bgcolor(BGColor4, 80, 0)
bgcolor(BGColor5, 80, 0)
bgcolor(BGColor6, 80, 0)
bgcolor(BGColor7, 80, 0)
bgcolor(BGColor8, 80, 0)
bgcolor(BGColor9, 80, 0)
bgcolor(BGColor10, 80, 0)
bgcolor(BGColor11, 80, 0)
bgcolor(BGColor12, 80, 0)
bgcolor(BGColor13, 80, 0)
bgcolor(BGColor14, 80, 0)
bgcolor(BGColor15, 80, 0)
bgcolor(BGColor16, 80, 0)
bgcolor(BGColor17, 80, 0)
bgcolor(BGColor18, 80, 0)
bgcolor(BGColor19, 80, 0)
bgcolor(BGColor20, 80, 0)
bgcolor(BGColor21, 80, 0)
bgcolor(BGColor22, 80, 0)
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Priority Support Contact Support Ideas Published Followers Following Private Messages Chat Sign Out