Here is an indicator for those of you that trade Forex.
#MarketTimes by Alfred Scott Jordan 10/22/22
# I combined the AU and Asian markets because in Forex these run together. You can either choose to show #the entire market or just the lunch periods. You can just turn the clouds off completely if desired.
input AU = " AU Market Settings";
input Open_AU = 1800; # time in ET
input start_AULunch = 2030;
input end_AULunch = 2130;
input Close_AU = 2355;
input ASIA = " ASIA Market Settings";
input Open_Asia = 2000; # time in ET
input start_AsiaLunch = 2230;
input end_AsiaLunch = 2330;
input Close_Asia = 0200;
input Show_AU_Asia_Market_Cloud= no;
input Show_AU_Lunch_Cloud= no;
input Show_Asia_Lunch_Cloud=no;
def AUopen= SecondsFromTime(Open_AU)>=0;
def AUopenup= if AUopen then double.positive_infinity else double.nan;
AddVerticalLine(AUopen[1] == 0 and AUopen == 1, text = "AU Open", color = Color.light_green );
def AUStart= SecondsFromTime(start_AULunch)>=0;
AddVerticalLine(AUStart == 1 and AUStart [1] == 0, text = "AU START" , color = Color.yellow );
def AUEnd= SecondsFromTime(end_AULunch)>=0;
AddVerticalLine(AUEnd == 1 and AUEnd [1] == 0, text = "AU END" , color = Color.yellow );
def AUclose = SecondsFromTime(Close_AU)>=0;
AddVerticalLine(AUclose[1] == 0 and AUclose == 1, text = "AU Close", color = Color.white);
def Asiaopen= SecondsFromTime(Open_Asia)>=0;
AddVerticalLine(Asiaopen[1] == 0 and Asiaopen == 1, text = "Asia Open", color = Color.light_green );
def AsiaStart= SecondsFromTime(start_AsiaLunch)>=0;
AddVerticalLine(AsiaStart == 1 and AsiaStart [1] == 0, text = "Asia START" , color = Color.yellow );
def AsiaEnd= SecondsFromTime(end_AsiaLunch)>=0;
AddVerticalLine(AsiaEnd == 1 and AsiaEnd [1] == 0, text = "Asia END" , color = Color.yellow );
def Asiaclose = SecondsFromTime(Close_Asia)>=0;
AddVerticalLine(Asiaclose[1] == 0 and Asiaclose == 1, text = "Asia Close", color = Color.white);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUopen, AUstart, Color.light_gray);
AddCloud( if !Show_AU_Lunch_Cloud then double.nan else AUstart, AUend, Color.yellow);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUend, AsiaStart, Color.light_gray);
AddCloud( if !Show_Asia_Lunch_Cloud then double.nan else Asiastart, Asiaend, Color.yellow);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else Asiaend, AUclose, Color.light_gray);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUclose + 1 , Asiaclose, Color.light_gray);
input UK = " UK Market Settings";
input Open_UK = 0300; # time in ET
input start_UKLunch = 0530;
input end_UKLunch = 0630;
input Close_UK = 1130;
input Show_UK_Market_Cloud= yes;
input Show_UK_Lunch_Cloud= yes;
def UKopen= SecondsFromTime(Open_UK)>=0;
AddVerticalLine(UKopen[1] == 0 and UKopen == 1, text = "UK Open", color = Color.light_green );
def UKStart= SecondsFromTime(start_UKLunch)>=0;
AddVerticalLine(UKStart == 1 and UKStart [1] == 0, text = "UK START" , color = Color.yellow );
def UKEnd= SecondsFromTime(end_UKLunch)>=0;
AddVerticalLine(UKEnd == 1 and UKEnd [1] == 0, text = "UK END" , color = Color.yellow );
def UKclose = SecondsFromTime(Close_UK)>=0;
AddVerticalLine(UKclose[1] == 0 and UKclose == 1, text = "UK Close", color = Color.white);
AddCloud(if !Show_UK_Market_Cloud then double.nan else UKopen, UKstart, Color.light_gray);
AddCloud(if !Show_UK_Lunch_Cloud then double.nan else UKstart, UKend, Color.yellow);
AddCloud(if !Show_UK_Market_Cloud then double.nan else UKEnd, UKclose, Color.light_gray);
input US = " US Market Settings";
input Open_US = 0930; # time in ET
input start_USLunch = 1200;
input end_USLunch = 1300;
input Close_US = 1600;
input Show_US_Market_Cloud= no;
input Show_US_Lunch_Cloud= no;
def USopen= SecondsFromTime(Open_US)>=0;
AddVerticalLine(USopen[1] == 0 and USopen == 1, text = "US Open", color = Color.light_green );
def USStart= SecondsFromTime(start_USLunch)>=0;
AddVerticalLine(USStart == 1 and USStart [1] == 0, text = "US START" , color = Color.yellow );
def USEnd= SecondsFromTime(end_USLunch)>=0;
AddVerticalLine(USEnd == 1 and USEnd [1] == 0, text = "US END" , color = Color.yellow );
def USclose = SecondsFromTime(Close_US)>=0;
AddVerticalLine(USclose[1] == 0 and USclose == 1, text = "US Close", color = Color.white);
AddCloud(if !Show_US_Market_Cloud then double.nan else USopen, USstart, Color.light_gray);
AddCloud(if !Show_US_Lunch_Cloud then double.nan else USstart, USend, Color.yellow);
AddCloud(if !Show_US_Market_Cloud then double.nan else USEnd, USclose, Color.light_gray);
AddCloud(if !Show_US_Market_Cloud then double.nan else USopen, USstart, Color.light_gray);
AddCloud(if !Show_US_Lunch_Cloud then double.nan else USstart, USend, Color.yellow);
AddCloud(if !Show_US_Market_Cloud then double.nan else USEnd, USclose, Color.light_gray);
[/CODE]
#MarketTimes by Alfred Scott Jordan 10/22/22
# I combined the AU and Asian markets because in Forex these run together. You can either choose to show #the entire market or just the lunch periods. You can just turn the clouds off completely if desired.
input AU = " AU Market Settings";
input Open_AU = 1800; # time in ET
input start_AULunch = 2030;
input end_AULunch = 2130;
input Close_AU = 2355;
input ASIA = " ASIA Market Settings";
input Open_Asia = 2000; # time in ET
input start_AsiaLunch = 2230;
input end_AsiaLunch = 2330;
input Close_Asia = 0200;
input Show_AU_Asia_Market_Cloud= no;
input Show_AU_Lunch_Cloud= no;
input Show_Asia_Lunch_Cloud=no;
def AUopen= SecondsFromTime(Open_AU)>=0;
def AUopenup= if AUopen then double.positive_infinity else double.nan;
AddVerticalLine(AUopen[1] == 0 and AUopen == 1, text = "AU Open", color = Color.light_green );
def AUStart= SecondsFromTime(start_AULunch)>=0;
AddVerticalLine(AUStart == 1 and AUStart [1] == 0, text = "AU START" , color = Color.yellow );
def AUEnd= SecondsFromTime(end_AULunch)>=0;
AddVerticalLine(AUEnd == 1 and AUEnd [1] == 0, text = "AU END" , color = Color.yellow );
def AUclose = SecondsFromTime(Close_AU)>=0;
AddVerticalLine(AUclose[1] == 0 and AUclose == 1, text = "AU Close", color = Color.white);
def Asiaopen= SecondsFromTime(Open_Asia)>=0;
AddVerticalLine(Asiaopen[1] == 0 and Asiaopen == 1, text = "Asia Open", color = Color.light_green );
def AsiaStart= SecondsFromTime(start_AsiaLunch)>=0;
AddVerticalLine(AsiaStart == 1 and AsiaStart [1] == 0, text = "Asia START" , color = Color.yellow );
def AsiaEnd= SecondsFromTime(end_AsiaLunch)>=0;
AddVerticalLine(AsiaEnd == 1 and AsiaEnd [1] == 0, text = "Asia END" , color = Color.yellow );
def Asiaclose = SecondsFromTime(Close_Asia)>=0;
AddVerticalLine(Asiaclose[1] == 0 and Asiaclose == 1, text = "Asia Close", color = Color.white);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUopen, AUstart, Color.light_gray);
AddCloud( if !Show_AU_Lunch_Cloud then double.nan else AUstart, AUend, Color.yellow);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUend, AsiaStart, Color.light_gray);
AddCloud( if !Show_Asia_Lunch_Cloud then double.nan else Asiastart, Asiaend, Color.yellow);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else Asiaend, AUclose, Color.light_gray);
AddCloud( if !Show_AU_Asia_Market_Cloud then double.nan else AUclose + 1 , Asiaclose, Color.light_gray);
input UK = " UK Market Settings";
input Open_UK = 0300; # time in ET
input start_UKLunch = 0530;
input end_UKLunch = 0630;
input Close_UK = 1130;
input Show_UK_Market_Cloud= yes;
input Show_UK_Lunch_Cloud= yes;
def UKopen= SecondsFromTime(Open_UK)>=0;
AddVerticalLine(UKopen[1] == 0 and UKopen == 1, text = "UK Open", color = Color.light_green );
def UKStart= SecondsFromTime(start_UKLunch)>=0;
AddVerticalLine(UKStart == 1 and UKStart [1] == 0, text = "UK START" , color = Color.yellow );
def UKEnd= SecondsFromTime(end_UKLunch)>=0;
AddVerticalLine(UKEnd == 1 and UKEnd [1] == 0, text = "UK END" , color = Color.yellow );
def UKclose = SecondsFromTime(Close_UK)>=0;
AddVerticalLine(UKclose[1] == 0 and UKclose == 1, text = "UK Close", color = Color.white);
AddCloud(if !Show_UK_Market_Cloud then double.nan else UKopen, UKstart, Color.light_gray);
AddCloud(if !Show_UK_Lunch_Cloud then double.nan else UKstart, UKend, Color.yellow);
AddCloud(if !Show_UK_Market_Cloud then double.nan else UKEnd, UKclose, Color.light_gray);
input US = " US Market Settings";
input Open_US = 0930; # time in ET
input start_USLunch = 1200;
input end_USLunch = 1300;
input Close_US = 1600;
input Show_US_Market_Cloud= no;
input Show_US_Lunch_Cloud= no;
def USopen= SecondsFromTime(Open_US)>=0;
AddVerticalLine(USopen[1] == 0 and USopen == 1, text = "US Open", color = Color.light_green );
def USStart= SecondsFromTime(start_USLunch)>=0;
AddVerticalLine(USStart == 1 and USStart [1] == 0, text = "US START" , color = Color.yellow );
def USEnd= SecondsFromTime(end_USLunch)>=0;
AddVerticalLine(USEnd == 1 and USEnd [1] == 0, text = "US END" , color = Color.yellow );
def USclose = SecondsFromTime(Close_US)>=0;
AddVerticalLine(USclose[1] == 0 and USclose == 1, text = "US Close", color = Color.white);
AddCloud(if !Show_US_Market_Cloud then double.nan else USopen, USstart, Color.light_gray);
AddCloud(if !Show_US_Lunch_Cloud then double.nan else USstart, USend, Color.yellow);
AddCloud(if !Show_US_Market_Cloud then double.nan else USEnd, USclose, Color.light_gray);
AddCloud(if !Show_US_Market_Cloud then double.nan else USopen, USstart, Color.light_gray);
AddCloud(if !Show_US_Lunch_Cloud then double.nan else USstart, USend, Color.yellow);
AddCloud(if !Show_US_Market_Cloud then double.nan else USEnd, USclose, Color.light_gray);
[/CODE]