Repaints World Daily Range Indicator For ThinkOrSwim

Repaints

whoDAT

New member
Plus
World Daily Range - Indicates Daily Range and Which Market is Open (US, AUS, JP, UK)

This indicator shows simple range lines for the prior day (or other period). Showing you the range of the prior day's high and low.
Uniquely, the indicator shows which market is open by coloring the line differently based on the time of day. In the image below, the time of day the Australian market is open is painted green; Japan is red; UK is blue; and US is white.

I use the indicator to quickly see the influence of certain markets on currencies, as there is more volatility and liquidity depending on the currency's home market.

World_DailyRange.jpg


Code:
# World Daily Range
# Indicates daily range (high, low) of a period.
# Indicates which market is open or influencing the range the most.
# by whoDAT  --  4/8/2025

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;                # 1 means we're interested in 1 AggregationPeriod (1 day for example)
input displace = -1;             # This displaces the linearRegAdjEMA by 1 AggregationPeriod. (-1 will displace the range by one day in the past.
input showOnlyLastPeriod = no;
input US_open = 0900;
input US_close = 1700;
input AU_open = 1500;
input AU_close = 2300;
input JP_open1 = 2301;
input JP_close1 = 2359;
input JP_open2 = 0000;
input JP_close2 = 0159;
input UK_open = 0200;
input UK_close = 0900;


plot DailyHigh;
plot DailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
    DailyHigh = Double.NaN;
    DailyLow = Double.NaN;
} else {
    DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
    DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}

def USperiod = if SecondsFromTime(US_open) >= 0 and SecondsTillTime(US_close) >= 0 then 1 else 0;
def UKperiod = if SecondsFromTime(UK_open) >= 0 and SecondsTillTime(UK_close) >= 0 then 1 else 0;
def AUperiod = if SecondsFromTime(AU_open) >= 0 and SecondsTillTime(AU_close) >= 0 then 1 else 0;
def JPperiod1 = if SecondsFromTime(JP_open1) >= 0 and SecondsTillTime(JP_close1) >= 0 then 1 else 0;
def JPperiod2 = if SecondsFromTime(JP_open2) >= 0 and SecondsTillTime(JP_close2) >= 0 then 1 else 0;

DailyHigh.AssignValueColor(if USperiod then color.white else if UKperiod then color.blue else if AUperiod then color.GREEN else if JPperiod1 then color.RED else if JPperiod2 then color.RED else Color.gray);

DailyLow.AssignValueColor(if USperiod then color.white else if UKperiod then color.blue else if AUperiod then color.GREEN else if JPperiod1 then color.RED else if JPperiod2 then color.RED else Color.gray);

DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Last edited by a moderator:

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