Market Crashes/Chart Timeframes Highlight
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © xkavalis

//@version=5
indicator("Market Crashes/Timeframes Highlight", "MCTH", overlay=true)
////bool in_87_Timeframe = time > s_first_date and time < e_first_date
first_start_date = input.time(timestamp("07 Sep 1987 00:00 +0300"), "1st Timeframe Start", "Enter Start Date","","Timeframe 1")
first_end_date = input.time(timestamp("31 Dec 1987 00:00 +0300"), "1st Timeframe End", "Enter End Date","","Timeframe 1")

second_start_date = input.time(timestamp("01 Jul 1990 00:00 +0300"), "2nd Timeframe Start", "Enter Start Date","","Timeframe 2")
second_end_date = input.time(timestamp("31 Oct 1990 00:00 +0300"), "2nd Timeframe End", "Enter End Date","","Timeframe 2")

third_start_date = input.time(timestamp("06 Mar 2000 00:00 +0300"), "3rd Timeframe Start", "Enter Start Date","","Timeframe 3")
third_end_date = input.time(timestamp("31 Aug 2002 00:00 +0300"), "3rd Timeframe End", "Enter End Date","","Timeframe 3")

fourth_start_date = input.time(timestamp("01 Sep 2007 00:00 +0300"), "4th Timeframe Start", "Enter Start Date","","Timeframe 4")
fourh_end_date = input.time(timestamp("01 Apr 2009 00:00 +0300"), "4th Timeframe End", "Enter End Date","","Timeframe 4")

fifth_start_date = input.time(timestamp("16 Dec 2016 00:00 +0300"), "5th Timeframe Start", "Enter Start Date","","Timeframe 5")
fifth_end_date = input.time(timestamp("31 Jan 2019 00:00 +0300"), "5th Timeframe End", "Enter End Date","","Timeframe 5")

sixth_start_date = input.time(timestamp("01 Feb 2020 00:00 +0300"), "6th Timeframe Start", "Enter Start Date","","Timeframe 6")
sixth_end_date = input.time(timestamp("26 May 2020 00:00 +0300"), "6th Timeframe End", "Enter End Date","","Timeframe 6")

seventh_start_date = input.time(timestamp("01 Apr 2021 00:00 +0300"), "7th Timeframe Start", "Enter Start Date","","Timeframe 7")
seventh_end_date = input.time(timestamp("15 Aug 2022 00:00 +0300"), "7th Timeframe End", "Enter End Date","","Timeframe 7")


bgcolor(time > first_start_date and time < first_end_date ? color.new(color.gray, 80) : na, offset=0, title="1st Timeframe")
bgcolor(time > second_start_date and time < second_end_date ? color.new(color.gray, 80) : na, offset=0, title="2nd Timeframe")
bgcolor(time > third_start_date and time < third_end_date ? color.new(color.gray, 80) : na, offset=0, title="3rd Timeframe")
bgcolor(time > fourth_start_date and time < fourh_end_date ? color.new(color.gray, 80) : na, offset=0, title="4th Timeframe")
bgcolor(time > fifth_start_date and time < fifth_end_date ? color.new(color.gray, 80) : na, offset=0, title="5th Timeframe")
bgcolor(time > sixth_start_date and time < sixth_end_date ? color.new(color.gray, 80) : na, offset=0, title="6th Timeframe")
bgcolor(time > seventh_start_date and time < seventh_end_date ? color.new(color.gray, 80) : na, offset=0, title="7th Timeframe")