// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © maruf_bd //@version=6 indicator("1") // == Contents: // 1= EMA 50, 100, 200 // = VWAP // 2= EMA 12, 21 // 3= Swing Indicator // 4= Asia, London, NY session // Show/hide _ema50_100_200 = input(false, "EMA 50, 100 & 200", inline = "most-used", group = "Most used:") _vwap = input(true, 'VWAP', group = 'Most used:') ema12_21 = input(false, "EMA 12 & 21", group = "Most used:", inline = "12/21") _only_alert_no_ema = input(false, "Only EMA tap alert, hide EMA", inline = "most-used", group = "Most used:") _show_ema = _only_alert_no_ema ? false : true _ema50 = input(true, "EMA 50", inline = "Regular EMAs", group = "Most used:" ) _ema100 = input(false, "EMA 100", inline = "Regular EMAs", group = "Most used:" ) _ema200 = input(false, "EMA 200", inline = "Regular EMAs", group = "Most used:" ) _ema12_21_cross_alert = input(false, "EMA 12 21 cross alert") _ema_crossover_alert = input(true, "EMA 50, 100, 200 crossover alert") _swing_indicator = input(false, "Swing Indicator") _market_sessions = input(true, "Market sessions?", inline = "most-used") //---- Colors _col_ema50 = input.color(color.rgb(67, 67, 67, 49), 'EMA 50', group = 'Color:') _col_ema100 = input.color(color.rgb(67, 67, 67, 49), 'EMA 100', group = 'Color:') _col_ema200 = input.color(color.rgb(67, 67, 67, 49), 'EMA 200', group = 'Color:') _col_vwap = input.color(color.rgb(4, 120, 173, 22), title = 'VWAP', group = 'Color:') _col_ema12 = input.color(color.rgb(157, 87, 248, 60), title = '12', group = 'Color:', inline = "12/21") _col_ema21 = input.color(color.rgb(157, 87, 248, 20), title = '21', group = 'Color:', inline = "12/21") //---- Timeframe calculation int chartTFInMinutes = timeframe.in_seconds() / 60 tf_minute = timeframe.isminutes ? true : false tf_h1 = timeframe.isminutes and timeframe.multiplier == 60 ? true : false tf_h4 = tf_minute ? timeframe.multiplier == 240 ? true : false : false tf_d = timeframe.isdaily ? true : false //---- Chart type isfxchart = syminfo.currency == 'USD' ? true : syminfo.currency == 'JPY' ? true : syminfo.currency == 'CAD' ? true : false notfxchart = syminfo.currency != 'USDT' or syminfo.currency != 'USDC' ? false : true //---- EMA calculation ema12 = ta.ema(close, 12) ema21 = ta.ema(close, 21) ema12_hourly = request.security(syminfo.tickerid, "60", ta.ema(close, 12)) ema21_hourly = request.security(syminfo.tickerid, "60", ta.ema(close, 21)) h1ema50 = request.security(syminfo.tickerid, "60", ta.ema(close, 50)) h1ema100 = request.security(syminfo.tickerid, "60", ta.ema(close, 100)) h1ema200 = request.security(syminfo.tickerid, "60", ta.ema(close, 200)) h4ema50 = request.security(syminfo.tickerid, "240", ta.ema(close, 50)) h4ema100 = request.security(syminfo.tickerid, "240", ta.ema(close, 100)) h4ema200 = request.security(syminfo.tickerid, "240", ta.ema(close, 200)) //---- Regular EMA ema50 = ta.ema(close, 50) ema100 = ta.ema(close, 100) ema200 = ta.ema(close, 200) //---- Plot plot( ema12_21 ? ema12 : na, color = _col_ema12, style=plot.style_line, display = display.all-display.price_scale) plot( ema12_21 ? ema21 : na, color = _col_ema21, style=plot.style_line, linewidth = 1, display = display.all-display.price_scale) crossing_ema12_21 = ta.crossover(ema12, ema21) and _ema12_21_cross_alert ? true : false plotshape( crossing_ema12_21, style=shape.circle, size = size.tiny, color=#058185, location = location.belowbar) plot( _ema50 and _show_ema ? ema50 : _ema50_100_200 and _show_ema ? ema50 : na, color=_col_ema50, display = display.pane) plot( _ema50_100_200 and _show_ema ? ema100 : _ema100 and _show_ema ? ema100 : na, color=_col_ema100, linewidth = 1, display = display.pane) plot( _ema50_100_200 and _show_ema ? ema200 : _ema200 and _show_ema ? ema200 : na, color=_col_ema200, linewidth = 2, display = display.pane) //---- EMA cross alert (10.8.2025) h1_ema50_tapped = low <= h1ema50 and close > h1ema50 ? true : false // h1 ema50 bullish tap crossing_h1ema50 = _ema_crossover_alert and h1_ema50_tapped ? true : false plotshape(crossing_h1ema50, style = shape.circle, location=location.bottom, color = color.rgb(75, 192, 96, 12)) h1_ema100_tapped = low <= h1ema100 and close > h1ema100 ? true : false // h1 ema100 bullish tap crossing_h1ema100 = _ema_crossover_alert and h1_ema100_tapped ? true : false plotshape(crossing_h1ema100, style = shape.cross, location=location.bottom, color = color.rgb(75, 192, 96, 12)) h1_ema200_tapped = low <= h1ema200 and close > h1ema200 ? true : false // h1 ema200 bullish tap crossing_h1ema200 = _ema_crossover_alert and h1_ema200_tapped ? true : false plotshape(crossing_h1ema200, style = shape.diamond, location=location.bottom, color = color.rgb(75, 192, 96, 12)) h4_ema50_tapped = low <= h4ema50 and close > h4ema50 ? true : false // h4 ema50 bullish tap crossing_h4ema50 = _ema_crossover_alert and h4_ema50_tapped ? true : false plotshape(crossing_h4ema50, style = shape.circle, location=location.bottom, color = color.rgb(104, 42, 112, 12)) h4_ema100_tapped = low <= h4ema100 and close > h4ema100 ? true : false // h4 ema100 bullish tap crossing_h4ema100 = _ema_crossover_alert and h4_ema100_tapped ? true : false plotshape(crossing_h4ema100, style = shape.cross, location=location.bottom, color = color.rgb(104, 42, 112, 12)) h4_ema200_tapped = low <= h4ema200 and close > h4ema200 ? true : false // h4 ema200 bullish tap crossing_h4ema200 = _ema_crossover_alert and h4_ema200_tapped ? true : false plotshape(crossing_h4ema200, style = shape.diamond, location=location.bottom, color = color.rgb(104, 42, 112, 12)) // ---- VWAP open_ = open close_ = close price_ = (open_+close_) / 2 price_vol = price_*volume price_vol_cummulative = math.sum(price_vol, 20) volume_averaged = math.sum(volume, 20) vwap_ = price_vol_cummulative / volume_averaged plot(_vwap? vwap_ : na, color = _col_vwap) // -------------------------------------------- // Market sessions //--------------------------------------------- // Session 1 - user inputs showTokyo = input.bool(true, '', inline='Tokyo', group='Sessions') stringTokyo = input.string('A', '', inline='Tokyo', group='Sessions') TokyoTimeX = input.session(defval="0000-0600", title='     ', inline='Tokyo2', group='Sessions', tooltip = 'If you want to change the start/end time of the session, just make sure they are in UTC. There is no need to change the timezone of your Tradingview chart or to change the Timezone input below, because the sessions will be plotted correctly as long as the start/end time is set in UTC.') TokyoCol = input.color(color.rgb(139, 133, 62, 79), '' , inline='Tokyo', group='Sessions') // Session 2 - user inputs showLondon = input.bool(true, '', inline='London', group='Sessions') stringLondon = input.string('L', '', inline='London', group='Sessions') LondonTimeX = input.session(defval="0800-1630", title='     ', inline='London2', group='Sessions', tooltip = 'If you want to change the start/end time of the session, just make sure they are in UTC. There is no need to change the timezone of your Tradingview chart or to change the Timezone input below, because the sessions will be plotted correctly as long as the start/end time is set in UTC.') LondonCol = input.color(color.rgb(175, 76, 76, 85), '' , inline='London', group='Sessions') // Session 3 - user inputs showNewYork = input.bool(true, title='', inline='New York', group='Sessions') stringNewYork = input.string('NY', '', inline='New York', group='Sessions') NewYorkTimeX = input.session(defval="1430-2130", title='     ', inline='New York2', group='Sessions', tooltip = 'If you want to change the start/end time of the session, just make sure they are in UTC. There is no need to change the timezone of your Tradingview chart or to change the Timezone input below, because the sessions will be plotted correctly as long as the start/end time is set in UTC.') NewYorkCol = input.color(color.rgb(33, 149, 243, 90), '', inline='New York', group='Sessions') // Additional tools and settings - user inputs pipChange = input.bool(false, 'Change (Pips) ', inline='0', group = 'Additional Tools and Settings') percentChange = input.bool(false, 'Change (%)', inline='0', group = 'Additional Tools and Settings') merge = input.bool(false, 'Merge Overlaps', inline='2', group = 'Additional Tools and Settings') hideWeekends = input.bool(true, 'Hide Weekends', inline='2', group = 'Additional Tools and Settings') sessionOC = input.bool(true, 'Open/Close Line', inline='3', group = 'Additional Tools and Settings') halfline = input.bool(false, 'Session 0.5 Level', inline='3', group = 'Additional Tools and Settings') colorcandles = input.bool(false, 'Color Candles  ', inline='4', group = 'Additional Tools and Settings') showScreener = input.bool(false, 'Screener (Soon)', inline='4', group = 'Additional Tools and Settings') displayType = input.string('Boxes', 'Display Type', options = ['Boxes', 'Zones','Timeline', 'Candles'], group='Additional Tools and Settings', tooltip='Choose whether the scripts should plot session in the for of boxes or colored background zones.') daysBack = input.float(150, 'Lookback (Days)', group='Additional Tools and Settings', tooltip= 'This inputs defines the lookback period for plotting sessions. Eg. If it is set to 1, only the sessions of the past day will appear') changeType = input.string('Session High/Low','Change (%/Pips) Source', options = ['Session High/Low', 'Session Open/Close'], group='Additional Tools and Settings', tooltip='Choose whether the Change (%) and Change (Pips) should measure the distance between Session High and Session Low or the distance between Session Open and Session Close.') SessionZone = input.string("UTC", title="Input Timezone", group='Additional Tools and Settings', tooltip = 'This input is defining the timezone for the session times selected above. It has nothing to do with the timezone of your chart, because the sessions will be plotted correctly even if your chart is not set to UTC.') // Appearance - user inputs borderWidth = input.int(1, 'Box Border', inline='border', group='Appearance') borderStyle = input.string('Dashed', '', ['Solid', 'Dashed', 'Dotted'] , inline='border', group='Appearance', tooltip='Select the width and style of session box borders') levelsStyle = input.string('Dashed', 'Line Style', ['Solid', 'Dashed', 'Dotted'], group='Appearance', tooltip='Select the style of 0.5 and Open/Close lines.') labelSize = input.string('Normal', 'Label Size', options = ['Auto', 'Tiny', 'Small', 'Normal'], group='Appearance', tooltip='Select the size of text labels.') showLabels = input.bool(false, 'Session Labels ', inline='00', group = 'Appearance') colorBoxes = input.bool(true, 'Box Background', inline='00', group = 'Appearance') // Excluding or Including Weekends var TokyoTime = hideWeekends ? TokyoTimeX+":123456" : TokyoTimeX+":1234567" var LondonTime = hideWeekends ? LondonTimeX+":123456" : LondonTimeX+":1234567" var NewYorkTime = hideWeekends ? NewYorkTimeX+":123456" : NewYorkTimeX+":1234567" // Defining Line Style and Label Size Variables lineStyle(x) => switch x 'Solid' => line.style_solid 'Dashed' => line.style_dashed 'Dotted' => line.style_dotted labelStyle(x) => switch x 'Auto' => size.auto 'Tiny' => size.tiny 'Small' => size.small 'Normal' => size.normal // Calculating inRange, used for lookback MSPD = 24 * 60 * 60 * 1000 lastBarDate = timestamp(year(timenow), month(timenow), dayofmonth(timenow), hour(timenow), minute(timenow), second(timenow)) thisBarDate = timestamp(year, month, dayofmonth, hour, minute, second) daysLeft = math.abs(math.floor((lastBarDate - thisBarDate) / MSPD)) inRange = daysLeft < daysBack // Session Time InTokyo(TokyoTime, TokyoTimeZone=syminfo.timezone) => not na(time(timeframe.period, TokyoTime, SessionZone)) InLondon(LondonTime, LondonTimeZone=syminfo.timezone) => not na(time(timeframe.period, LondonTime, SessionZone)) InNewYork(NewYorkTime, NewYorkTimeZone=syminfo.timezone) => not na(time(timeframe.period, NewYorkTime, SessionZone)) // Creating variables Session High, Low, Open and Session Boxes, Lines and Texts var TokyoHighPrice = 0.0, var TokyoLowPrice = 0.0, var TokyoOpenPrice = 0.0, var box TokyoBox = na, var line TokyoLine = na, var label TokyoLabel = na, var line TokyoOC = na, var string TokyoText = str.tostring(stringTokyo) var LondonHighPrice = 0.0, var LondonLowPrice = 0.0, var LondonOpenPrice = 0.0, var box LondonBox = na, var line LondonLine = na, var label LondonLabel = na, var line LondonOC = na, var string LondonText = str.tostring(stringLondon) var NewYorkHighPrice = 0.0, var NewYorkLowPrice = 0.0, var NewYorkOpenPrice = 0.0, var box NewYorkBox = na, var line NewYorkLine = na, var label NewYorkLabel = na, var line NewYorkOC = na, var string NewYorkText = str.tostring(stringNewYork) // Checking if session is active/has started inTokyo = InTokyo(TokyoTime, SessionZone) and timeframe.isintraday TokyoStart = inTokyo and not inTokyo[1] inLondon = InLondon(LondonTime, SessionZone) and timeframe.isintraday LondonStart = inLondon and not inLondon[1] inNewYork = InNewYork(NewYorkTime, SessionZone) and timeframe.isintraday NewYorkStart = inNewYork and not inNewYork[1] // Settings high, low, open at the beggining of the session if TokyoStart TokyoHighPrice := high TokyoLowPrice := low TokyoOpenPrice := open if LondonStart LondonHighPrice := high LondonLowPrice := low LondonOpenPrice := open if NewYorkStart NewYorkHighPrice := high NewYorkLowPrice := low NewYorkOpenPrice := open // Track session's max high and max low during the session else if inTokyo TokyoHighPrice := math.max(TokyoHighPrice, high) TokyoLowPrice := math.min(TokyoLowPrice, low) else if inLondon LondonHighPrice := math.max(LondonHighPrice, high) LondonLowPrice := math.min(LondonLowPrice, low) else if inNewYork NewYorkHighPrice := math.max(NewYorkHighPrice, high) NewYorkLowPrice := math.min(NewYorkLowPrice, low) // Plotting session boxes at the beginning of each session if TokyoStart and showTokyo and inRange and isfxchart TokyoBox := displayType=='Boxes' ? box.new(left=bar_index, top=na, right=na, bottom=na, border_width=borderWidth, bgcolor = colorBoxes ? TokyoCol : na, border_style = lineStyle(borderStyle), border_color=color.new(TokyoCol, 100)) : na TokyoLine := halfline ? line.new(x1=bar_index, y1=na, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(TokyoCol, 40)) : na TokyoLabel := showLabels ? label.new(x=na, y=na, text=TokyoText, textcolor=color.new(TokyoCol, 40), color=color.rgb(0,0,0,100), size=labelStyle(labelSize)) : na TokyoOC := sessionOC ? line.new(x1=bar_index, y1=TokyoOpenPrice, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(TokyoCol, 100)) : na if LondonStart and showLondon and inRange and isfxchart LondonBox := displayType=='Boxes' ? box.new(left=bar_index, top=na, right=na, bottom=na, border_width=borderWidth, bgcolor = colorBoxes ? LondonCol : na, border_style = lineStyle(borderStyle), border_color=color.new(LondonCol, 100)) : na LondonLine := halfline ? line.new(x1=bar_index, y1=na, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(LondonCol, 40)) : na LondonLabel := showLabels ? label.new(x=na, y=na, text=LondonText, textcolor=color.new(LondonCol, 40), color=color.rgb(0,0,0,100), size=labelStyle(labelSize)) : na LondonOC := sessionOC ? line.new(x1=bar_index, y1=LondonOpenPrice, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(LondonCol, 100)) : na if NewYorkStart and showNewYork and inRange and isfxchart NewYorkBox := displayType=='Boxes' ? box.new(left=bar_index, top=na, right=na, bottom=na, border_width=borderWidth, bgcolor = colorBoxes ? NewYorkCol : na, border_style = lineStyle(borderStyle), border_color=color.new(NewYorkCol, 100)) : na NewYorkLine := halfline ? line.new(x1=bar_index, y1=na, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(NewYorkCol, 40)) : na NewYorkLabel := showLabels ? label.new(x=na, y=na, text=NewYorkText, textcolor=color.new(NewYorkCol, 40), color=color.rgb(0,0,0,100), size=labelStyle(labelSize)) : na NewYorkOC := sessionOC ? line.new(x1=bar_index, y1=NewYorkOpenPrice, x2=na, y2=na, style=lineStyle(levelsStyle), color = color.new(NewYorkCol, 100)) : na // Creating variables for alternative Sessions Box top and bottom (used for merging sessions) var float TokyoHighM = 0, var float TokyoLowM = 0, var float LondonHighM = 0, var float LondonLowM = 0, var float NewYorkHighM = 0, var float NewYorkLowM = 0 // Updating session boxes during sessions if inTokyo and inRange TokyoHighPrice := math.max(TokyoHighPrice, high) TokyoLowPrice := math.min(TokyoLowPrice, low) box.set_top(TokyoBox, TokyoHighPrice) box.set_bottom(TokyoBox, TokyoLowPrice) box.set_right(TokyoBox, bar_index + 1) label.set_x(TokyoLabel, (box.get_left(TokyoBox)+box.get_right(TokyoBox))/2) label.set_y(TokyoLabel, TokyoHighPrice) if sessionOC line.set_x2(TokyoOC, bar_index) line.set_y2(TokyoOC, close) if halfline line.set_y1(TokyoLine, (TokyoHighPrice+TokyoLowPrice)/2) line.set_y2(TokyoLine, (TokyoHighPrice+TokyoLowPrice)/2) line.set_x2(TokyoLine, bar_index+1) if merge and not inLondon and showLondon TokyoHighM := TokyoHighPrice TokyoLowM := TokyoLowPrice if merge and inLondon and showLondon box.set_top(TokyoBox, TokyoHighM) box.set_bottom(TokyoBox, TokyoLowM) label.set_y(TokyoLabel, TokyoHighM) box.set_right(TokyoBox, (box.get_left(LondonBox))) line.set_x2(TokyoLine, (box.get_left(LondonBox))) label.set_x(TokyoLabel, (box.get_left(TokyoBox)+box.get_right(TokyoBox))/2) line.set_x2(TokyoOC, (box.get_left(LondonBox))) line.set_y2(TokyoOC, LondonOpenPrice) line.set_y1(TokyoLine, (TokyoHighM+TokyoLowM)/2) line.set_y2(TokyoLine, (TokyoHighM+TokyoLowM)/2) var float pips = 0 var float chg = 0 pips := changeType=='Session High/Low' ? ((TokyoHighPrice - TokyoLowPrice) / syminfo.mintick / 10) : ((close - TokyoOpenPrice) / syminfo.mintick / 10) chg := changeType=='Session Open/Close' ? (100 * (close - TokyoOpenPrice) / TokyoOpenPrice) : ((TokyoHighPrice - TokyoLowPrice) / TokyoLowPrice * 100) if percentChange and not pipChange label.set_text(TokyoLabel, str.tostring(TokyoText) + ' (' + str.tostring(chg, format.percent) + ')') if pipChange and not percentChange label.set_text(TokyoLabel, str.tostring(TokyoText) + ' (' + str.tostring(pips) + ')') if percentChange and pipChange label.set_text(TokyoLabel, str.tostring(TokyoText) + ' ('+ str.tostring(chg, format.percent)+ ' • ' + str.tostring(pips) + ')') if inLondon and inRange LondonHighPrice := math.max(LondonHighPrice, high) LondonLowPrice := math.min(LondonLowPrice, low) box.set_top(LondonBox, LondonHighPrice) box.set_bottom(LondonBox, LondonLowPrice) box.set_right(LondonBox, bar_index+1) label.set_x(LondonLabel, (box.get_left(LondonBox)+box.get_right(LondonBox))/2) label.set_y(LondonLabel, LondonHighPrice) if sessionOC line.set_x2(LondonOC, bar_index) line.set_y2(LondonOC, close) if halfline line.set_y1(LondonLine, (LondonHighPrice+LondonLowPrice)/2) line.set_y2(LondonLine, (LondonHighPrice+LondonLowPrice)/2) line.set_x2(LondonLine, bar_index+1) if merge and not inNewYork and showNewYork LondonHighM := LondonHighPrice LondonLowM := LondonLowPrice if merge and inNewYork and showNewYork box.set_top(LondonBox, LondonHighM) box.set_bottom(LondonBox, LondonLowM) label.set_y(LondonLabel, LondonHighM) box.set_right(LondonBox, (box.get_left(NewYorkBox))) line.set_x2(LondonLine, (box.get_left(NewYorkBox))) label.set_x(LondonLabel, (box.get_left(LondonBox)+box.get_right(LondonBox))/2) line.set_x2(LondonOC, (box.get_left(NewYorkBox))) line.set_y2(LondonOC, NewYorkOpenPrice) line.set_y1(LondonLine, (LondonHighM+LondonLowM)/2) line.set_y2(LondonLine, (LondonHighM+LondonLowM)/2) var float pips = 0 var float chg = 0 pips := changeType=='Session High/Low' ? ((LondonHighPrice - LondonLowPrice) / syminfo.mintick / 10) : ((close - LondonOpenPrice) / syminfo.mintick / 10) chg := changeType=='Session Open/Close' ? (100 * (close - LondonOpenPrice) / LondonOpenPrice) : ((LondonHighPrice - LondonLowPrice) / LondonLowPrice * 100) if percentChange and not pipChange label.set_text(LondonLabel, str.tostring(LondonText) + ' (' + str.tostring(chg, format.percent) + ')') if pipChange and not percentChange label.set_text(LondonLabel, str.tostring(LondonText) + ' (' + str.tostring(pips) + ')') if percentChange and pipChange label.set_text(LondonLabel, str.tostring(LondonText) + ' ('+ str.tostring(chg, format.percent)+ ' • ' + str.tostring(pips) + ')') if inNewYork and inRange NewYorkHighPrice := math.max(NewYorkHighPrice, high) NewYorkLowPrice := math.min(NewYorkLowPrice, low) box.set_top(NewYorkBox, NewYorkHighPrice) box.set_bottom(NewYorkBox, NewYorkLowPrice) box.set_right(NewYorkBox, bar_index + 1) label.set_x(NewYorkLabel, (box.get_left(NewYorkBox)+box.get_right(NewYorkBox))/2) label.set_y(NewYorkLabel, NewYorkHighPrice) if sessionOC line.set_x2(NewYorkOC, bar_index) line.set_y2(NewYorkOC, close) if halfline line.set_y1(NewYorkLine, (NewYorkHighPrice+NewYorkLowPrice)/2) line.set_y2(NewYorkLine, (NewYorkHighPrice+NewYorkLowPrice)/2) line.set_x2(NewYorkLine, bar_index+1) var float pips = 0 var float chg = 0 pips := changeType=='Session High/Low' ? ((NewYorkHighPrice - NewYorkLowPrice) / syminfo.mintick / 10) : ((close - NewYorkOpenPrice) / syminfo.mintick / 10) chg := changeType=='Session Open/Close' ? (100 * (close - NewYorkOpenPrice) / NewYorkOpenPrice) : ((NewYorkHighPrice - NewYorkLowPrice) / NewYorkLowPrice * 100) if percentChange and not pipChange label.set_text(NewYorkLabel, str.tostring(NewYorkText) + ' (' + str.tostring(chg, format.percent) + ')') if pipChange and not percentChange label.set_text(NewYorkLabel, str.tostring(NewYorkText) + ' (' + str.tostring(pips) + ')') if percentChange and pipChange label.set_text(NewYorkLabel, str.tostring(NewYorkText) + ' ('+ str.tostring(chg, format.percent)+ ' • ' + str.tostring(pips) + ')') // Coloring candles TKLO = showLondon ? (not inLondon) : true LONY = showNewYork ? (not inNewYork) : true // Coloring background if displayType=='Zones' TokyoT = time(timeframe.period, TokyoTime) LondonT = time(timeframe.period, LondonTime) NewYorkT = time(timeframe.period, NewYorkTime) bgcolor(displayType == 'Zones' and not merge and showTokyo and inRange and time == TokyoT ? TokyoCol : na, editable = false) bgcolor(displayType == 'Zones' and not merge and showLondon and inRange and time == LondonT ? LondonCol : na, editable = false) bgcolor(displayType == 'Zones' and not merge and showNewYork and inRange and time == NewYorkT ? NewYorkCol : na, editable = false) bgcolor(displayType == 'Zones' and merge and not inLondon and showTokyo and inRange and time == TokyoT ? TokyoCol : na, editable = false) bgcolor(displayType == 'Zones' and merge and not inNewYork and showLondon and inRange and time == LondonT ? LondonCol : na, editable = false)