Very simple script to apply colours to Gold market areas. Includes Globex daily stop and morning London fix. Doesn't know how to handle weekends (yet).
// Calibrated to UTC study(title="Gold Market Session Breakdown in UTC [perlboy]", shorttitle="Gold Session Zones", overlay=true) timeinrange(res, sess) => time(res, sess) != 0 // Turn sessions on or off //selectBangkok = input(false, title='Bangkok Trading') //selectBrazil = input(false, title='Brazil Trading') //selectDubai = input(false, title='Dubai Trading') selectEurex = input(false, title='Eurex Trading') selectGlobex = input(true, title='Globex Daily Close (5-6pm)') selectHongKong = input(true, title='Hong Kong Trading') //selectIslamabad = input(false, title='Islamabad Trading') //selectIstanbul = input(false, title='Istanbul Trading') //selectJakarta = input(false, title='Jakarta Trading') //selectJohannesburg = input(false, title='Johannesburg Trading') //selectKathmandu = input(false, title='Kathmandu Trading') selectLondon = input(true, title='London Trading') selectLondonFix = input(true, title='London Morning Fix') selectMoscow = input(false, title='Moscow Trading') //selectMumbai = input(false, title='Mumbai Trading') selectNewYork = input(true, title='New York Trading') selectShanghai = input(true, title='Shanghai Trading') selectSingapore = input(false, title='Singapore Trading') selectSydney = input(true, title='Sydney Trading') //selectTaipei = input(false, title='Taipei Trading') //selectTokyo = input(false, title='Tokyo Trading') selectZurich = input(false, title='Zurich Trading') // Disabled entries selectBangkok = false selectBrazil = false selectDubai = false selectIslamabad = false selectIstanbul = false selectJakarta = false selectJohannesburg = false selectKathmandu = false selectMumbai = false selectTaipei = false selectTokyo = false // Weekday and Sunday boolean checks isWeekday = iff(dayofweek(time) != sunday and dayofweek(time) != saturday, 1, 0) isSunday = iff(dayofweek(time) == sunday, 1, 0) // Colour breakdowns BangkokBar = white BrazilBar = maroon DubaiBar = navy EurexBar = gray GlobexBar = gray HongKongBar = green IslamabadBar = olive IstanbulBar = yellow JakartaBar = green JohannesburgBar = silver KathmanduBar = teal LondonBar = red MoscowBar = aqua MumbaiBar = fuchsia NewYorkBar = yellow ShanghaiBar = green SingaporeBar = orange SydneyBar = teal TaipeiBar = gray TokyoBar = lime ZurichBar = lime GlobexClose = purple // Trading hours, source: http://www.sharelynx.com/papers/GoldFuturesMarkets.php // GMT TimeZone -5 hours : New York opens at 1320 GMT - closes at 1830 GMT // GMT TimeZone -5 hours : Globex opens at 2300 GMT - closes at 2215 GMT // GMT TimeZone +0 hours : London opens at 0800 GMT - closes at 1700 GMT // GMT TimeZone -3 hours : Brazil opens at 1300 GMT - closes at 2000 GMT then opens at 2045 GMT - closes at 2200 GMT // GMT TimeZone +8 hours : Shanghai opens at 0100 GMT - closes at 0330 GMT then opens at 0530 GMT - closes at 0700 GMT // GMT TimeZone +8 hours : Hong Kong opens at 0100 GMT - closes at 0430 GMT then opens at 0630 GMT - closes at 0900 GMT // GMT TimeZone +5.30 hours : Mumbai opens at 0430 GMT - closes at 1800 GMT // GMT TimeZone +7 hours : Jakarta opens at 0230 GMT - closes at 1030 GMT // GMT TimeZone +9 hours : Tokyo opens at 0000 GMT - closes at 0630 GMT then opens at 0800 GMT - closes at 1400 GMT // GMT TimeZone +5 hours : Islamabad opens at 0500 GMT - closes at 1300 GMT // GMT TimeZone +2 hours : Istanbul opens at 0745 GMT - closes at 1530 GMT then opens at 1545 GMT - closes at 0740 GMT // GMT TimeZone +4 hours : Dubai opens at 0430 GMT - closes at 0730 GMT // GMT TimeZone +1 hours : Eurex opens at 0700 GMT - closes at 2130 GMT // GMT TimeZone +5:45 hours : Kathmandu opens at 0245 GMT - closes at 1745 GMT // GMT TimeZone +3 hours : Moscow opens at 0730 GMT - closes at 1545 GMT then opens at 1600 GMT - closes at 2050 GMT // GMT TimeZone +8 hours : Singapore opens at 0030 GMT - closes at 1500 GMT // GMT TimeZone +2 hours : Johannesburg opens at 0700 GMT - closes at 1345 GMT // GMT TimeZone +8 hours : Taipei opens at 0045 GMT - closes at 0545 GMT // GMT TimeZone +7 hours : Bangkok opens at 0245 GMT - closes at 0530 GMT then opens at 0730 GMT - closes at 0955 GMT // GMT TimeZone +8 hours : Sydney opens at 2300 GMT - closes at 0500 GMT // GMT TimeZone +1 hour : Zurich opens at 0700 GMT - closes at 1600 GMT // Normal days chartColour = ((selectNewYork and isWeekday > 0 and time(period, '1320-1830') > 0) ? NewYorkBar : ((selectGlobex and isWeekday > 0 and time(period, '2145-2215') > 0) ? GlobexClose : ((selectLondonFix and isWeekday > 0 and time(period, '0750-0815') > 0) ? orange : ((selectLondon and isWeekday > 0 and time(period, '0800-1700') > 0) ? LondonBar : // ((selectBrazil and isWeekday > 0 and time(period, '1300-2000 ') > 0) ? BrazilBar : // ((selectBrazil and isWeekday > 0 and time(period, '2045-2200') > 0) ? BrazilBar : na))))) ((selectShanghai and isWeekday > 0 and time(period, '0100-0330') > 0) ? ShanghaiBar : ((selectShanghai and isWeekday > 0 and time(period, '0530-0700') > 0) ? ShanghaiBar : ((selectHongKong and isWeekday > 0 and time(period, '0100-0430') > 0) ? HongKongBar : ((selectHongKong and isWeekday > 0 and time(period, '0630-0900') > 0) ? HongKongBar : ((selectMumbai and isWeekday > 0 and time(period, '0430-1800') > 0) ? MumbaiBar : ((selectJakarta and isWeekday > 0 and time(period, '0230-1030') > 0) ? JakartaBar : ((selectTokyo and isWeekday > 0 and time(period, '0000-0630') > 0) ? TokyoBar : ((selectTokyo and isWeekday > 0 and time(period, '0800-1400') > 0) ? TokyoBar : ((selectIslamabad and isWeekday > 0 and time(period, '0500-1300') > 0) ? IslamabadBar : ((selectIstanbul and isWeekday > 0 and time(period, '0745-1530') > 0) ? IstanbulBar : ((selectIstanbul and isWeekday > 0 and time(period, '1545-0740') > 0) ? IstanbulBar : ((selectDubai and isWeekday > 0 and time(period, '0430-0730') > 0) ? DubaiBar : ((selectEurex and isWeekday > 0 and time(period, '0700-2130') > 0) ? EurexBar : ((selectKathmandu and isWeekday > 0 and time(period, '0245-1745') > 0) ? KathmanduBar : ((selectMoscow and isWeekday > 0 and time(period, '0730-1545') > 0) ? MoscowBar : ((selectMoscow and isWeekday > 0 and time(period, '1600-2050') > 0) ? MoscowBar : ((selectSingapore and isWeekday > 0 and time(period, '0030-1500') > 0) ? SingaporeBar : ((selectJohannesburg and isWeekday > 0 and time(period, '0700-1345') > 0) ? JohannesburgBar : ((selectTaipei and isWeekday > 0 and time(period, '0045-0545') > 0) ? TaipeiBar : ((selectBangkok and isWeekday > 0 and time(period, '0245-0530') > 0) ? BangkokBar : ((selectBangkok and isWeekday > 0 and time(period, '0730-0955') > 0) ? BangkokBar : ((selectSydney and isWeekday > 0 and time(period, '2300-0500') > 0) ? SydneyBar : ((selectZurich and isWeekday > 0 and time(period, '0700-1600') > 0) ? ZurichBar : black))))))))))))))))))))))))))) // Apply background colours bgcolor(chartColour, transp=80)