Asian, UK, US Market Times For Forex In ThinkOrSwim

powerhousescott

New member
VIP
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]
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
310 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top