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.
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.
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: