Intraday Time Markers For ThinkOrSwim

baTrader

New member
Plus
Time Clouds II is a time-based chart overlay that marks specific intraday moments using full-height, one-bar-wide visual markers. Instead of analyzing price, volume, or indicators, it focuses purely on when events occur during the trading session.

The purpose of this study is to highlight repeatable time-of-day patterns that often correspond to shifts in market behavior. These may include liquidity events, session transitions (such as Globex to regular trading hours), or other recurring periods where volatility, participation, or directional movement tends to change.

Each cloud represents a predefined time and is designed to be immediately visible without cluttering the chart. Because the markers span the full height of the chart and are only one bar wide, they provide clear timing reference points without interfering with price structure.

This tool is commonly used to:
  • Identify and track key intraday time windows
  • Improve awareness of when volatility or participation tends to increase
  • Anchor discretionary trading decisions to specific times
  • Build or support time-based trading frameworks
  • Quickly orient to the structure of the trading session
The study is fully customizable, allowing each time slot to be enabled or disabled and assigned a color (typically green or red) to reflect context or bias. It also uses a robust time-detection method, ensuring that markers appear reliably even during extended hours or on charts where exact timestamps may not align perfectly.

Importantly, Time Clouds II does not generate trade signals or predict direction. It is a structural timing tool designed to complement other forms of analysis by answering a simple but critical question: when is this moment occurring in the session?

TimeClouds.png

Code:
# =====================================================================
# TIME CLOUDS II — ONE-BAR EVENT CLOUDS (FULL ENABLE CONTROL)
# =====================================================================
# Author: baTrader
# Version: 3.6
# Last Update: 2026-03-30
#
# DESCRIPTION:
# This study paints full-height, one-bar-wide clouds at user-defined
# intraday times. Each cloud is triggered on the first bar at or after
# its assigned time, making the timing logic more robust than strict
# exact-bar matching.
#
# PURPOSE:
# This is a time-based structural overlay intended to mark repeatable
# intraday moments that may matter for market behavior, workflow, or
# execution planning.
#
# Typical uses include:
# - highlighting known liquidity / activity windows
# - marking recurring Globex or RTH transition points
# - visually anchoring discretionary trade timing
# - identifying time-based zones of interest without relying on price
# - creating a consistent intraday timing framework across sessions
#
# This study is designed to answer:
#   "When is this recurring moment occurring on the chart?"
#
# rather than:
#   "What is price forecasting?"
#
# FUNCTIONAL CHARACTERISTICS:
# - one-bar-wide clouds for precise time marking
# - full-height rendering for fast visual recognition
# - per-time enable control via useTimeN
# - per-time color control via colorTimeN
# - scalable slot-based design for adding future time markers
# - robust time capture suitable for Globex and extended-hours use
#
# WHEN CLOUDS MAY NOT DISPLAY:
# - Extended Hours disabled:
#     Globex / premarket times (e.g., 08:30, 09:00) will not appear if
#     the chart is set to Regular Trading Hours only.
#
# - Aggregation period too large:
#     On higher timeframes (e.g., 15m, 30m, 1h), the exact target time
#     may not align with a bar boundary. In this case, the cloud will
#     appear on the first bar AFTER the specified time, or may appear
#     visually shifted.
#
# - Time not present in session:
#     If the specified time does not exist within the visible session
#     (due to instrument hours or chart settings), no cloud will render.
#
# - currentDayOnly = yes:
#     Clouds will only display for the most recent trading day. Historical
#     occurrences will be hidden.
#
# - showClouds = no:
#     All clouds are globally disabled.
#
# - Disabled slot:
#     If useTimeN = no, that specific cloud will not render.
#
# IMPORTANT NOTE:
# This study is a time-reference tool only.
# It does NOT:
# - predict direction
# - evaluate price action
# - use volume, momentum, or other indicators
# - generate standalone trade signals
#
# INPUT NAMING CONVENTION:
#   timeN / useTimeN / colorTimeN
#
# Example:
#   time1
#   useTime1
#   colorTime1
# =====================================================================

declare upper;
declare hide_on_daily;

# =====================================================================
# 1. GLOBAL COLOR SYSTEM
# =====================================================================
DefineGlobalColor("Red", Color.RED);
DefineGlobalColor("Green", Color.GREEN);

# =====================================================================
# 2. INPUTS
# =====================================================================
input showClouds = yes;
input currentDayOnly = yes;

# --- Primary Slots ---
input time1 = 0830;
input useTime1 = yes;
input colorTime1 = {default Green, Red};

input time2 = 0900;
input useTime2 = yes;
input colorTime2 = {default Green, Red};

input time3 = 0935;
input useTime3 = yes;
input colorTime3 = {default Red, Green};

input time4 = 0940;
input useTime4 = yes;
input colorTime4 = {default Green, Red};

input time5 = 1000;
input useTime5 = yes;
input colorTime5 = {default Red, Green};

input time6 = 1020;
input useTime6 = yes;
input colorTime6 = {default Green, Red};

input time7 = 1045;
input useTime7 = yes;
input colorTime7 = {default Red, Green};

input time8 = 1100;
input useTime8 = yes;
input colorTime8 = {default Red, Green};

input time9 = 1120;
input useTime9 = yes;
input colorTime9 = {default Green, Red};

input time10 = 1140;
input useTime10 = yes;
input colorTime10 = {default Green, Red};

input time11 = 1200;
input useTime11 = yes;
input colorTime11 = {default Green, Red};

# --- Additional Optional Slots Added ---
input time12 = 1230;
input useTime12 = no;
input colorTime12 = {default Green, Red};

input time13 = 1300;
input useTime13 = no;
input colorTime13 = {default Green, Red};

input time14 = 1330;
input useTime14 = no;
input colorTime14 = {default Green, Red};

input time15 = 1345;
input useTime15 = no;
input colorTime15 = {default Green, Red};

input time16 = 1400;
input useTime16 = no;
input colorTime16 = {default Green, Red};

# =====================================================================
# 3. BASE SERIES
# =====================================================================
def isCurrentDay = GetDay() == GetLastDay();
def dayFilter = if currentDayOnly then isCurrentDay else yes;

def topBand = Double.POSITIVE_INFINITY;
def botBand = Double.NEGATIVE_INFINITY;
def cloudBottom = botBand;

# =====================================================================
# 4. ROBUST TIME CAPTURE
# =====================================================================
def at1  = dayFilter and useTime1  and SecondsFromTime(time1)  >= 0 and SecondsFromTime(time1)[1]  < 0;
def at2  = dayFilter and useTime2  and SecondsFromTime(time2)  >= 0 and SecondsFromTime(time2)[1]  < 0;
def at3  = dayFilter and useTime3  and SecondsFromTime(time3)  >= 0 and SecondsFromTime(time3)[1]  < 0;
def at4  = dayFilter and useTime4  and SecondsFromTime(time4)  >= 0 and SecondsFromTime(time4)[1]  < 0;
def at5  = dayFilter and useTime5  and SecondsFromTime(time5)  >= 0 and SecondsFromTime(time5)[1]  < 0;
def at6  = dayFilter and useTime6  and SecondsFromTime(time6)  >= 0 and SecondsFromTime(time6)[1]  < 0;
def at7  = dayFilter and useTime7  and SecondsFromTime(time7)  >= 0 and SecondsFromTime(time7)[1]  < 0;
def at8  = dayFilter and useTime8  and SecondsFromTime(time8)  >= 0 and SecondsFromTime(time8)[1]  < 0;
def at9  = dayFilter and useTime9  and SecondsFromTime(time9)  >= 0 and SecondsFromTime(time9)[1]  < 0;
def at10 = dayFilter and useTime10 and SecondsFromTime(time10) >= 0 and SecondsFromTime(time10)[1] < 0;
def at11 = dayFilter and useTime11 and SecondsFromTime(time11) >= 0 and SecondsFromTime(time11)[1] < 0;

def at12 = dayFilter and useTime12 and SecondsFromTime(time12) >= 0 and SecondsFromTime(time12)[1] < 0;
def at13 = dayFilter and useTime13 and SecondsFromTime(time13) >= 0 and SecondsFromTime(time13)[1] < 0;
def at14 = dayFilter and useTime14 and SecondsFromTime(time14) >= 0 and SecondsFromTime(time14)[1] < 0;
def at15 = dayFilter and useTime15 and SecondsFromTime(time15) >= 0 and SecondsFromTime(time15)[1] < 0;
def at16 = dayFilter and useTime16 and SecondsFromTime(time16) >= 0 and SecondsFromTime(time16)[1] < 0;

# =====================================================================
# 5. TOP SERIES
# =====================================================================
def top1  = if showClouds and at1  then topBand else botBand;
def top2  = if showClouds and at2  then topBand else botBand;
def top3  = if showClouds and at3  then topBand else botBand;
def top4  = if showClouds and at4  then topBand else botBand;
def top5  = if showClouds and at5  then topBand else botBand;
def top6  = if showClouds and at6  then topBand else botBand;
def top7  = if showClouds and at7  then topBand else botBand;
def top8  = if showClouds and at8  then topBand else botBand;
def top9  = if showClouds and at9  then topBand else botBand;
def top10 = if showClouds and at10 then topBand else botBand;
def top11 = if showClouds and at11 then topBand else botBand;

def top12 = if showClouds and at12 then topBand else botBand;
def top13 = if showClouds and at13 then topBand else botBand;
def top14 = if showClouds and at14 then topBand else botBand;
def top15 = if showClouds and at15 then topBand else botBand;
def top16 = if showClouds and at16 then topBand else botBand;

# =====================================================================
# 6. CLOUD RENDERING
# =====================================================================
AddCloud(top1,  cloudBottom, if colorTime1  == colorTime1.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime1  == colorTime1.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top2,  cloudBottom, if colorTime2  == colorTime2.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime2  == colorTime2.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top3,  cloudBottom, if colorTime3  == colorTime3.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime3  == colorTime3.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top4,  cloudBottom, if colorTime4  == colorTime4.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime4  == colorTime4.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top5,  cloudBottom, if colorTime5  == colorTime5.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime5  == colorTime5.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top6,  cloudBottom, if colorTime6  == colorTime6.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime6  == colorTime6.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top7,  cloudBottom, if colorTime7  == colorTime7.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime7  == colorTime7.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top8,  cloudBottom, if colorTime8  == colorTime8.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime8  == colorTime8.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top9,  cloudBottom, if colorTime9  == colorTime9.Green  then GlobalColor("Green") else GlobalColor("Red"), if colorTime9  == colorTime9.Green  then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top10, cloudBottom, if colorTime10 == colorTime10.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime10 == colorTime10.Green then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top11, cloudBottom, if colorTime11 == colorTime11.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime11 == colorTime11.Green then GlobalColor("Green") else GlobalColor("Red"));

AddCloud(top12, cloudBottom, if colorTime12 == colorTime12.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime12 == colorTime12.Green then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top13, cloudBottom, if colorTime13 == colorTime13.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime13 == colorTime13.Green then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top14, cloudBottom, if colorTime14 == colorTime14.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime14 == colorTime14.Green then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top15, cloudBottom, if colorTime15 == colorTime15.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime15 == colorTime15.Green then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(top16, cloudBottom, if colorTime16 == colorTime16.Green then GlobalColor("Green") else GlobalColor("Red"), if colorTime16 == colorTime16.Green then GlobalColor("Green") else GlobalColor("Red"));
 

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
880 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