vertical line at intraday times for ThinkOrSwim

chiropteraphile

New member
Plots vertical lines to alert key intraday times, such as 8:30am unemployment data, or the 2pm reversal period.

Edit to customize your preferred event times, works for futures and equities.
Screenshot 2024-02-02 at 12.10.02 PM.png

Code:
#
input targetTime830 = 830;
def targetBar830 = SecondsFromTime(targetTime830) == 0;
AddVerticalLine(targetBar830, "DATA DROP", Color.WHITE);

input targetTime930 = 930;
def targetBar930 = SecondsFromTime(targetTime930) == 0;
AddVerticalLine(targetBar930, "OPEN", Color.WHITE);

input targetTime1120 = 1120;
def targetBar1120 = SecondsFromTime(targetTime1120) == 0;
AddVerticalLine(targetBar1120, "EUROPE CLOSING SOON", Color.WHITE);

input targetTime1358 = 1358;
def targetBar1358 = SecondsFromTime(targetTime1358) == 0;
AddVerticalLine(targetBar1358, "2PM INCOMING", Color.WHITE);

input targetTime1540 = 1540;
def targetBar1540 = SecondsFromTime(targetTime1540) == 0;
AddVerticalLine(targetBar1540, "CLOSE IN 5 MINS", Color.RED);
#
 
Last edited by a moderator:

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

Plots vertical lines to alert key intraday times, such as 8:30am unemployment data, or the 2pm reversal period.

Edit to customize your preferred event times, works for futures and equities.
View attachment 20886
Code:
#
input targetTime830 = 830;
def targetBar830 = SecondsFromTime(targetTime830) == 0;
AddVerticalLine(targetBar830, "DATA DROP", Color.WHITE);

input targetTime930 = 930;
def targetBar930 = SecondsFromTime(targetTime930) == 0;
AddVerticalLine(targetBar930, "OPEN", Color.WHITE);

input targetTime1120 = 1120;
def targetBar1120 = SecondsFromTime(targetTime1120) == 0;
AddVerticalLine(targetBar1120, "EUROPE CLOSING SOON", Color.WHITE);

input targetTime1358 = 1358;
def targetBar1358 = SecondsFromTime(targetTime1358) == 0;
AddVerticalLine(targetBar1358, "2PM INCOMING", Color.WHITE);

input targetTime1540 = 1540;
def targetBar1540 = SecondsFromTime(targetTime1540) == 0;
AddVerticalLine(targetBar1540, "CLOSE IN 5 MINS", Color.RED);
#
Nice addition to my AsGoodAsItGets_UpperVerticalTransitionLine ...Thanks
 
Plots vertical lines to alert key intraday times, such as 8:30am unemployment data, or the 2pm reversal period.

Edit to customize your preferred event times, works for futures and equities.
View attachment 20886
Code:
#
input targetTime830 = 830;
def targetBar830 = SecondsFromTime(targetTime830) == 0;
AddVerticalLine(targetBar830, "DATA DROP", Color.WHITE);

input targetTime930 = 930;
def targetBar930 = SecondsFromTime(targetTime930) == 0;
AddVerticalLine(targetBar930, "OPEN", Color.WHITE);

input targetTime1120 = 1120;
def targetBar1120 = SecondsFromTime(targetTime1120) == 0;
AddVerticalLine(targetBar1120, "EUROPE CLOSING SOON", Color.WHITE);

input targetTime1358 = 1358;
def targetBar1358 = SecondsFromTime(targetTime1358) == 0;
AddVerticalLine(targetBar1358, "2PM INCOMING", Color.WHITE);

input targetTime1540 = 1540;
def targetBar1540 = SecondsFromTime(targetTime1540) == 0;
AddVerticalLine(targetBar1540, "CLOSE IN 5 MINS", Color.RED);
#
I added the European open (Living in Arizona I calculated the times accordingly). ThinkorSwim does not seem to chart from "1800 to 200" so I marked the EuroMarket at the earliest possible time:

I also added @mashume code for the high/low of the London and Tokyo markets, as I felt they worked well together(I turned off the clouds though) https://usethinkscript.com/threads/...york-markets-for-thinkorswim.14520/post-47723

Important times possible
Opens: 1:00am AZ, Closes: 9:30 am AZ
Opens at Midnight AZ, Closes 2pm AZ

(when the day changes in ThinkorSwim youll notice a jump in price),
London Stock Exchange: Opens at 8 AM and closes at 4:30 PM local time
Euronext (Paris stock exchange): Opens at 9 AM and closes at 5:30 PM local time
Euronext Amsterdam Stock Exchange: Opens at 9 AM and closes at 5:30 PM Central European Standard Time (GMT+01:00) Monday through Friday
Frankfurt Stock Exchange: Opens at 8 AM and closes at 10 PM Central European Standard Time (GMT+01:00) Monday through Friday
Vienna Stock Exchange: Opens at 8 AM UK time and closes at 4:30 PM UK time
Euronext Brussels (Belgium): Opens at 8 AM UK time and closes at 4:30 PM UK time
Euronext Lisbon (Portugal): Opens at 8 AM UK time and closes at 4:30 PM UK time

Code:
#
input targetTime230 = 400;
def targetBar230 = SecondsFromTime(targetTime230) == 0;
AddVerticalLine(targetBar230, "EURO_OPEN",Color.White);

input targetTime830 = 830;
def targetBar830 = SecondsFromTime(targetTime830) == 0;
AddVerticalLine(targetBar830, "DATA DROP", Color.WHITE);

input targetTime930 = 930;
def targetBar930 = SecondsFromTime(targetTime930) == 0;
AddVerticalLine(targetBar930, "OPEN", Color.WHITE);

input targetTime1120 = 1120;
def targetBar1120 = SecondsFromTime(targetTime1120) == 0;
AddVerticalLine(targetBar1120, "EUROPE CLOSING SOON", Color.WHITE);

input targetTime1358 = 1358;
def targetBar1358 = SecondsFromTime(targetTime1358) == 0;
AddVerticalLine(targetBar1358, "2PM INCOMING", Color.WHITE);

input targetTime1540 = 1540;
def targetBar1540 = SecondsFromTime(targetTime1540) == 0;
AddVerticalLine(targetBar1540, "CLOSE IN 5 MINS", Color.RED);

#------------------------------------------------------------
# Opening hours and ranges of global markets
# for usethinkscript
# mashume
# 2021-01-07
declare upper;

input EUOpen = 8;
input EUClose = 16.5;

input LondonOpen = 8;
input LondonClose = 16.5;

def D = 86400;
def HalfHour = 1800;
def epoch = (getTime() / 1000);

def GMT = Floor((epoch % D) / HalfHour) / 2;
def GMT_plus9 = if GMT > 15 then GMT - 15 else if GMT < 15 then (GMT + 24) - 15 else 0;

input TokyoOpen = 9;
input TokyoClose = 15;

def last24 = highestall(getTime()) - (86400 * 1000);

def EU = if GMT > EUOpen and GMT <= EUClose and gettime() >= last24 then 1 else 0;

def London = if (GMT > LondonOpen and gmt <= LondonClose and gettime() >= last24) then 1 else 0;

def Tokyo = if (GMT_plus9 > TokyoOpen and GMT_plus9 <= TokyoClose) and gettime() >= last24 then 1 else 0;

def EUHighs = if EU == 1 then high else double.nan;
def EULows = if EU == 1 then low else double.nan;
def EUHighest = highestAll(EUHighs);
def EULowest = lowestAll(EULows);

def LondonHighs = if London == 1 then high else double.nan;
def LondonLows = if London == 1 then low else double.nan;
def LondonHighest = highestAll(LondonHighs);
def LondonLowest = lowestAll(LondonLows);

def TokyoHighs = if Tokyo == 1 then high else double.nan;
def TokyoLows = if Tokyo == 1 then low else double.nan;
def TokyoHighest = highestAll(TokyoHighs);
def TokyoLowest = lowestAll(TokyoLows);

#plot EUActiveHigh = if EU == 1 then EUHighest else double.nan;
#plot EUActiveLow = if EU == 1 then EULowest else double.nan;
#AddCloud(EUActiveLow, EUActiveHigh, Color.BLUE, color.BLUE);

plot LondonActiveHigh = if London == 1 then LondonHighest else double.nan;
plot LondonActiveLow = if London == 1 then LondonLowest else double.nan;
#AddCloud(LondonActiveLow, LondonActiveHigh, Color.GRAY, color.GRAY);

plot TokyoActiveHigh = if Tokyo == 1 then TokyoHighest else double.nan;
plot TokyoActiveLow = if Tokyo == 1 then TokyoLowest else double.nan;
#AddCloud(TokyoActiveLow, TokyoActiveHigh, Color.GRAY, color.GRAY);


#
 

Attachments

  • Screen Shot 2024-02-07 at 10.42.17 AM.png
    Screen Shot 2024-02-07 at 10.42.17 AM.png
    70.6 KB · Views: 56
How could we use this information to make a scanner for price changes in the Tokyo and London markets?
I think this would be a good way to identify stocks that are going to move before the NY Stock Exchange opens. Any thoughts on the utility of such a scanner?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
176 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