Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © ArdOfCrypto
- //@version=5
- indicator("Session Levels", overlay=true, max_bars_back=1000, max_lines_count=500, max_labels_count=500, max_boxes_count=50)
- // Sessions and inputs
- i_GlobexSession = input.session(title="Globex ", defval="1700-0830", group="Session Settings", inline="GS") // Globex (Overnight) Session, Monday - Friday 17:00 - 0830. Globex opens at 5pm CST and closes when the US session starts 8:30CST.
- i_GlobexSessionCol = input.color(title="Color",tooltip="Globex Session Highlight Color", defval=color.silver, group="Session Settings", inline="GS") // Globex (Overnight) Session, color setting for background highlights
- i_GlobexLevelCol = input.color(title="Color",tooltip="Globex Levels Color", defval=color.gray, group="Session Settings", inline="GS") // Globex (Overnight) Session, color setting for level lines
- i_AsianSession = input.session(title="Asian ", defval="1900-0200", group="Session Settings", inline="AS") // Asian Session, Monday - Friday
- i_AsianSessionCol = input.color(title="Color",tooltip="Asian Session Highlight Color", defval=color.white, group="Session Settings", inline="AS") // Asian Session, color setting for background highlights, 1st hr box and High and Low lines
- i_AsianLevelCol = input.color(title="Color",tooltip="Asian Levels Color", defval=color.gray, group="Session Settings", inline="AS") // Asian Session, color setting for level lines
- i_AsianORoffset = input.int(title="Asian Open Offset", tooltip="Asian Session Opening Range Starts after x minutes", defval=30, minval=0, maxval=59, group="Session Settings") // Asian Opening Range Initial Balance Opening Minute
- i_LondonSession = input.session(title="London ", defval="0300-1100", group="Session Settings", inline="LS") // London Session, Monday - Friday
- i_LondonSessionCol = input.color(title="Color",tooltip="London Session Highlight Color", defval=color.green, group="Session Settings", inline="LS") // London Session, color setting for background highlights, 1st hr box and High and Low lines
- i_LondonLevelCol = input.color(title="Color",tooltip="London Levels Color", defval=color.gray, group="Session Settings", inline="LS") // London Session, color setting for level lines
- i_LondonORoffset = input.int(title="London Open Offset", tooltip="London Session Opening Range Starts after x minutes", defval=30, minval=0, maxval=59, group="Session Settings") // London Opening Range Initial Balance Opening Minute
- i_NewYorkSession = input.session(title="New York", defval="0800-1600", group="Session Settings", inline="NY") // New York Session
- i_NYSessionCol = input.color(title="Color",tooltip="New York Session Highlight Color", defval=color.blue, group="Session Settings", inline="NY") // New York Session, color setting for background highlights, 1st hr box and High and Low lines
- i_NYLevelCol = input.color(title="Color",tooltip="New York Level Color", defval=color.gray, group="Session Settings", inline="NY") // New York Session, color setting for level lines
- i_NewYorkORoffset = input.int(title="New York Open Offset", tooltip="New York Session Opening Range Starts after x minutes", defval=30, minval=0, maxval=59, group="Session Settings") // New York Opening Range Initial Balance Opening Minute
- i_NYSessionEndHour = input.int(title="NY CashSession End Hour", defval=16, minval=0, maxval=23, group="Session Settings", inline="NYE") // New York Session Opening Hour
- i_NYSessionEndMin = input.int(title="Min.", defval=59, minval=0, maxval=59, group="Session Settings", inline="NYE", tooltip="This is where all the lines and drawings end. Must be Less than the start of Globex") // New York Session Opening Minute
- GlobexSession = time(timeframe.period, i_GlobexSession, "America/Chicago") // Calculate time for the Globex/Overnight session.
- AsianSession = time(timeframe.period, i_AsianSession, "America/Chicago") // Calculate time for the Asian Session.
- LondonSession = time(timeframe.period, i_LondonSession, "America/Chicago") // Calculate time for the London Session.
- NewYorkSession = time(timeframe.period, i_NewYorkSession, "America/Chicago") // Calculate time for the New York Session.
- var CashSessionEndTime = timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- srcHi = input(high, "Source for Highs", inline="Sources", group="Source") // Set Source for Highs used in calculations
- srcLo = input(low, "Source for Lows", inline="Sources", group="Source") // Set Source for Lows used in calculations
- showGlobex = input.bool(defval=true, title="Globex Overnight", tooltip="Show Globex Background Highlight", group="Session Highlight")
- showAsian = input.bool(defval=false, title="Asian", tooltip="Show Asian Background Highlight", group="Session Highlight")
- showLondon = input.bool(defval=false, title="London", tooltip="Show London Background Highlight", group="Session Highlight")
- showNewYork = input.bool(defval=true, title="New York", tooltip="Show NY Background Highlight", group="Session Highlight")
- showOpenbar = input.bool(defval=true, title="NY IB Opening Bar", tooltip="Show bar before the NY Initial Balance Highlight", group="Session Highlight")
- showTodaysDrawings = input.bool(defval=true, title="Show Todays Drawings Only", tooltip="Removes all historic drawings for cleaner charts", group="Drawings")
- showGlobexDrawings = input.bool(defval=true, title="Show Globex/Overnight Levels", tooltip="Show Globex/Overnight Drawings", group="Drawings")
- showAsianDrawings = input.bool(defval=false, title="Show Asian Levels", tooltip="Show Asian Session Drawings ", group="Drawings")
- showAsianOR = input.bool(defval=false, title="Show Asian Opening Range", tooltip="Show Asian Session Initial Balance Box ", group="Drawings")
- showAsianORStdev = input.bool(defval=false, title="Show Asian OR STDEV Projections", tooltip="Show Asian Standard Deviation Levels and Labels on Opening Range", group="Drawings")
- showLondonDrawings = input.bool(defval=false, title="Show London Levels", tooltip="Show London Session Drawings ", group="Drawings")
- showLondonOR = input.bool(defval=false, title="Show London Opening Range", tooltip="Show London Session Initial Balance Box ", group="Drawings")
- showLondonORStdev = input.bool(defval=false, title="Show London OR STDEV Projections", tooltip="Show London Standard Deviation Levels and Labels on Opening Range", group="Drawings")
- showNewYorkDrawings = input.bool(defval=true, title="Show New York Levels", tooltip="Show New York Session Session Drawings ", group="Drawings")
- showNewYorkOR = input.bool(defval=true, title="Show New York Opening Range", tooltip="Show New York Session Initial Balance Box ", group="Drawings")
- showNewYorkORStdev = input.bool(defval=false, title="Show New York OR STDEV Projections", tooltip="Show New York Standard Deviation Levels and Labels on Opening Range", group="Drawings")
- enableNewYorkalarms = input.bool(defval=false, title="Enable Alarms for the NY Session", tooltip="Alarms when price crosses: Globex Hi and Low; Hi, Lo, 50% OR Levels and 0.5 and 1.0 STDEV Levels", group="Alarms")
- showLabels = input.bool(defval=true, title="Show labels on Level Lines ", tooltip="Show Session Labels on every line", group="Drawings")
- showPDO = input.bool(defval=false, title="Show Previous Day Open", tooltip="Show Previous Days's Open line", group="HTF Levels")
- showPDC = input.bool(defval=true, title="Show Previous Day Close", tooltip="Show Previous Days's Closing line", group="HTF Levels")
- showPWO = input.bool(defval=true, title="Show Previous Week Open", tooltip="Show Previous Week's Opening price line", group="HTF Levels")
- showPWC = input.bool(defval=false, title="Show Previous Week Close", tooltip="Show Previous Week's Closing line", group="HTF Levels")
- showDebug = input.bool(defval=false, title="Show Debug Plot Values", tooltip="View values in the data window", group="DEBUG")
- // Get HTF Values
- PreviousDayClose = request.security(syminfo.tickerid, "D", close[1], lookahead = barmerge.lookahead_on) // Get the Previous Day's closing price
- PreviousDayOpen = request.security(syminfo.tickerid, "D", open[1], lookahead = barmerge.lookahead_on) // Get the Previous Day's opening price
- PreviousWeekClose = request.security(syminfo.tickerid, "W", close[1], lookahead = barmerge.lookahead_on) // Get the Previous Week's closing price
- PreviousWeekOpen = request.security(syminfo.tickerid, "W", open[1], lookahead = barmerge.lookahead_on) // Get the Previous Week's opening price
- // Set variables for the sessions
- // Globex Overnight session
- var float Globex_hi = na // High for the Globex Session
- var float Globex_75 = na // 75% level for the Globex Session
- var float Globex_50 = na // 50% level for the Globex Session
- var float Globex_25 = na // 25% level for the Globex Session
- var float Globex_lo = na // Low for the Globex Session
- var Globex_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_GlobexLevelCol) // Globex High line
- var Globex_line_75 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_GlobexLevelCol) // Globex 75% line
- var Globex_line_50 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_GlobexLevelCol) // Globex 50% line
- var Globex_line_25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_GlobexLevelCol) // Globex 25% line
- var Globex_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_GlobexLevelCol) // Globex Low line
- var GlobexHighLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left)
- var Globex75Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left)
- var Globex50Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left)
- var Globex25Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left)
- var GlobexLowLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left)
- var GlobexSessionStart = time // To register the timestap when the Globex Overnight Session begins
- // Asian Session
- var float Asian_hi = na // High for the Asian Session
- var float Asian_75 = na // 75% level for the Asian Session
- var float Asian_50 = na // 50% level for the Asian Session
- var float Asian_25 = na // 25% level for the Asian Session
- var float Asian_lo = na // Low for the Asian Session
- var Asian_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianLevelCol) // Asian High line
- var Asian_line_75 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianLevelCol) // Asian 75% line
- var Asian_line_50 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianLevelCol) // Asian 50% line
- var Asian_line_25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianLevelCol) // Asian 25% line
- var Asian_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianLevelCol) // Asian Low line
- var AsianHighLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var Asian75Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var Asian50Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var Asian25Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianLowLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianSessionStart = time // To register the timestap when the Asian Session begins
- var AsianORStart = AsianSessionStart + (i_AsianORoffset * 60000) // Add the offset in milliseconds
- var AsianOREnd = AsianORStart + 3600000 // Add one hour in milliseconds
- // Asian Opening Range (1st Hour)
- var float AsianHr1hi = 0.0 // High for the 1st Hour Session
- var float AsianHr1lo = 0.0 // Low for the 1st Hour Session
- var AsianOR_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianSessionCol) // Opening Range High
- var AsianOR_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianSessionCol) // Opening Range Low
- var AsianOR_line_hi10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- var AsianOR_line_hi15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- var AsianOR_line_hi175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- var AsianOR_line_hi20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- var AsianOR_line_hi225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- var AsianOR_line_hi25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- var AsianOR_line_hi30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- var AsianOR_line_lo10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- var AsianOR_line_lo15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- var AsianOR_line_lo175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- var AsianOR_line_lo20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- var AsianOR_line_lo225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- var AsianOR_line_lo25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- var AsianOR_line_lo30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- var AsianORBox = box.new(left=AsianORStart, top=na, right=AsianOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_AsianSessionCol, 100), bgcolor=color.new(i_AsianSessionCol, 70))
- var AsianORLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelHigh = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelHigh10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelHigh20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelHigh30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelLow = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelLow10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelLow20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var AsianORLabelLow30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- // ***
- // London Session
- var float London_hi = na // High for the London Session
- var float London_75 = na // 75% level for the London Session
- var float London_50 = na // 50% level for the London Session
- var float London_25 = na // 25% level for the London Session
- var float London_lo = na // Low for the London Session
- var London_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // London High line
- var London_line_75 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // London 75% line
- var London_line_50 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // London 50% line
- var London_line_25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // London 25% line
- var London_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // London Low line
- var LondonHighLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var London75Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var London50Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var London25Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonLowLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonSessionStart = time // To register the timestap when the London Session begins
- var LondonORStart = LondonSessionStart + (i_LondonORoffset * 60000) // Add the offset in milliseconds
- var LondonOREnd = LondonORStart + 3600000 // Add one hour in milliseconds
- // London Opening Range (1st Hour)
- var float LondonHr1hi = 0.0 // High for the 1st Hour Session
- var float LondonHr1lo = 0.0 // Low for the 1st Hour Session
- var LondonOR_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_LondonSessionCol) // Opening Range High
- var LondonOR_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_LondonSessionCol) // Opening Range Low
- var LondonOR_line_hi10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- var LondonOR_line_hi15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- var LondonOR_line_hi175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- var LondonOR_line_hi20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- var LondonOR_line_hi225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- var LondonOR_line_hi25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- var LondonOR_line_hi30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- var LondonOR_line_lo10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- var LondonOR_line_lo15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- var LondonOR_line_lo175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- var LondonOR_line_lo20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- var LondonOR_line_lo225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- var LondonOR_line_lo25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- var LondonOR_line_lo30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- var LondonORBox = box.new(left=LondonORStart, top=na, right=LondonOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_LondonSessionCol, 100), bgcolor=color.new(i_LondonSessionCol, 70))
- var LondonORLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelHigh = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelHigh10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelHigh20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelHigh30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelLow = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelLow10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelLow20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var LondonORLabelLow30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- // ***
- // New York Session
- var float NewYork_hi = na // High for the NewYork Session
- var float NewYork_75 = na // 75% level for the NewYork Session
- var float NewYork_50 = na // 50% level for the NewYork Session
- var float NewYork_25 = na // 25% level for the NewYork Session
- var float NewYork_lo = na // Low for the NewYork Session
- var NewYork_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYLevelCol) // NewYork High line
- var NewYork_line_75 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYLevelCol) // NewYork 75% line
- var NewYork_line_50 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYLevelCol) // NewYork 50% line
- var NewYork_line_25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYLevelCol) // NewYork 25% line
- var NewYork_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYLevelCol) // NewYork Low line
- var NewYorkHighLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYork75Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYork50Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYork25Label = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkLowLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkSessionStart = time // To register the timestap when the NewYork Session begins
- var NewYorkORStart = NewYorkSessionStart + (i_NewYorkORoffset * 60000) // Add the offset in milliseconds
- var NewYorkOREnd = NewYorkORStart + 3600000 // Add one hour in milliseconds
- // NewYork Opening Range (1st Hour)
- var float NewYorkHr1hi = 0.0 // High for the 1st Hour Session
- var float NewYorkHr1mid = 0.0 // 50% of the 1st Hour Session
- var float NewYorkHr1lo = 0.0 // Low for the 1st Hour Session
- var NewYorkOR_line_hi = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range High
- var NewYorkOR_line_mid = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range Middle
- var NewYorkOR_line_lo = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range Low
- var NewYorkOR_line_hi05 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.teal) // Opening Range High 0.5 STDEV of OR
- var NewYorkOR_line_hi10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- var NewYorkOR_line_hi15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- var NewYorkOR_line_hi175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- var NewYorkOR_line_hi20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- var NewYorkOR_line_hi225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- var NewYorkOR_line_hi25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- var NewYorkOR_line_hi30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- var NewYorkOR_line_lo05 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.maroon) // Opening Range Low 0.5 STDEV of OR
- var NewYorkOR_line_lo10 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- var NewYorkOR_line_lo15 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- var NewYorkOR_line_lo175 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- var NewYorkOR_line_lo20 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- var NewYorkOR_line_lo225 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- var NewYorkOR_line_lo25 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- var NewYorkOR_line_lo30 = line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- var NewYorkORBox = box.new(left=NewYorkORStart, top=na, right=NewYorkOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_NYSessionCol, 100), bgcolor=color.new(i_NYSessionCol, 70))
- var NewYorkORLabelHigh = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelHigh05 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelHigh10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelHigh20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelHigh30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelLow = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelLow05 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelLow10 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelLow20 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelLow30 = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- var NewYorkORLabelMid = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- // ***
- //
- // ALERTS Configuration for use during NY Session
- //
- // Function to trigger alerts when price crosses the Globex / Overnight Low during the NY Session
- f_triggerGlobexLow()=>
- _co = ta.crossover(close, Globex_lo)
- _cu = ta.crossunder(close, Globex_lo)
- if _co and NewYorkSession and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over Globex Low (" + str.tostring(Globex_lo) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession
- alert("Price (" + str.tostring(close) + ") crossing under Globex Low (" + str.tostring(Globex_lo) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the Globex / Overnight High during the NY Session
- f_triggerGlobexHigh()=>
- _co = ta.crossover(close, Globex_hi)
- _cu = ta.crossunder(close, Globex_hi)
- if _co and NewYorkSession and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over Globex High (" + str.tostring(Globex_hi) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession
- alert("Price (" + str.tostring(close) + ") crossing under Globex High (" + str.tostring(Globex_hi) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the NY Opening Range 50% level during the NY Session
- f_triggerNewYorkOR50perc()=>
- _NewYorkOR50perc = (NewYorkHr1lo+(NewYorkHr1hi-NewYorkHr1lo)/2)
- _co = ta.crossover(close, _NewYorkOR50perc)
- _cu = ta.crossunder(close, _NewYorkOR50perc)
- if _co and NewYorkSession and time > NewYorkOREnd and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over NY OR 50% (" + str.tostring(_NewYorkOR50perc) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession and time > NewYorkOREnd
- alert("Price (" + str.tostring(close) + ") crossing under NY OR 50% (" + str.tostring(_NewYorkOR50perc) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the NY Opening Range STDEV 0.5 level during the NY Session
- f_triggerNewYorkSTDEVpos05()=>
- _NewYorkSTDEVpos05=(NewYorkHr1hi+(NewYorkHr1hi-NewYorkHr1lo)/2)
- _co = ta.crossover(close, _NewYorkSTDEVpos05)
- _cu = ta.crossunder(close, _NewYorkSTDEVpos05)
- if _co and NewYorkSession and time > NewYorkOREnd and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over NY STDEV 0.5 (" + str.tostring(_NewYorkSTDEVpos05) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession and time > NewYorkOREnd
- alert("Price (" + str.tostring(close) + ") crossing under NY STDEV 0.5 (" + str.tostring(_NewYorkSTDEVpos05) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the NY Opening Range STDEV 1.0 level during the NY Session
- f_triggerNewYorkSTDEVpos10()=>
- _NewYorkSTDEVpos10=NewYorkHr1hi+(NewYorkHr1hi-NewYorkHr1lo)
- _co = ta.crossover(close, _NewYorkSTDEVpos10)
- _cu = ta.crossunder(close, _NewYorkSTDEVpos10)
- if _co and NewYorkSession and time > NewYorkOREnd and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over NY STDEV 1.0 (" + str.tostring(_NewYorkSTDEVpos10) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession and time > NewYorkOREnd
- alert("Price (" + str.tostring(close) + ") crossing under NY STDEV 1.0 (" + str.tostring(_NewYorkSTDEVpos10) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the NY Opening Range STDEV 0.5 level during the NY Session
- f_triggerNewYorkSTDEVneg05()=>
- _NewYorkSTDEVneg05=(NewYorkHr1lo-(NewYorkHr1hi-NewYorkHr1lo)/2)
- _co = ta.crossover(close, _NewYorkSTDEVneg05)
- _cu = ta.crossunder(close, _NewYorkSTDEVneg05)
- if _co and NewYorkSession and time > NewYorkOREnd and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over NY STDEV -0.5 (" + str.tostring(_NewYorkSTDEVneg05) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession and time > NewYorkOREnd
- alert("Price (" + str.tostring(close) + ") crossing under NY STDEV -0.5 (" + str.tostring(_NewYorkSTDEVneg05) + ")", alert.freq_once_per_bar)
- //
- // Function to trigger alerts when price crosses the NY Opening Range STDEV 1.0 level during the NY Session
- f_triggerNewYorkSTDEVneg10()=>
- _NewYorkSTDEVneg10=NewYorkHr1lo-(NewYorkHr1hi-NewYorkHr1lo)
- _co = ta.crossover(close, _NewYorkSTDEVneg10)
- _cu = ta.crossunder(close, _NewYorkSTDEVneg10)
- if _co and NewYorkSession and time > NewYorkOREnd and enableNewYorkalarms
- alert("Price (" + str.tostring(close) + ") crossing over NY STDEV -1.0 (" + str.tostring(_NewYorkSTDEVneg10) + ")", alert.freq_once_per_bar)
- else if _cu and NewYorkSession and time > NewYorkOREnd
- alert("Price (" + str.tostring(close) + ") crossing under NY STDEV -1.0 (" + str.tostring(_NewYorkSTDEVneg10) + ")", alert.freq_once_per_bar)
- //
- // End of Alert functions
- // Function for determining the Start of a Session (taken from the Pinescript manual: https://www.tradingview.com/pine-script-docs/en/v5/concepts/Sessions.html )
- sessionBegins(sess) =>
- t = time("", sess , "America/Chicago")
- timeframe.isintraday and (not barstate.isfirst) and na(t[1]) and not na(t)
- // End function
- // Start Logic
- //bool isNewDate = ta.change(time("D")) // Determine if new day has started. This is used to create new lines and labels.
- // *** Here the actual sessions begin:
- //
- // Begin Globex Session Code
- if sessionBegins(i_GlobexSession) // When a new Globex Session is started
- GlobexSessionStart := time // Store the Session Starting timestamp
- CashSessionEndTime := timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- if CashSessionEndTime < GlobexSessionStart // If the CashSessionEndTime is in the past, then add 1 day
- CashSessionEndTime := CashSessionEndTime+86400000 // Add 1 day, so level lines will be drawn to the right like they should
- // We are entering Globex Session hours; reset hi/lo.
- Globex_hi := srcHi
- Globex_lo := srcLo
- Globex_75 := Globex_lo+(Globex_hi-Globex_lo)*0.75
- Globex_50 := Globex_lo+(Globex_hi-Globex_lo)*0.5
- Globex_25 := Globex_lo+(Globex_hi-Globex_lo)*0.25
- // Initialize the drawings for today
- if showGlobexDrawings
- // Keep or Remove all historic levels
- if showTodaysDrawings // If true then delete all old objects
- line.delete(Globex_line_hi[1])
- line.delete(Globex_line_75[1])
- line.delete(Globex_line_50[1])
- line.delete(Globex_line_25[1])
- line.delete(Globex_line_lo[1])
- label.delete(GlobexHighLabel[1])
- label.delete(Globex75Label[1])
- label.delete(Globex50Label[1])
- label.delete(Globex25Label[1])
- label.delete(GlobexLowLabel[1])
- // Create new objects for today
- Globex_line_hi := line.new(x1=GlobexSessionStart, y1=Globex_hi, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=Globex_hi, color=i_GlobexLevelCol) // Globex High line
- Globex_line_75 := line.new(x1=GlobexSessionStart, y1=Globex_75, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=Globex_75, color=i_GlobexLevelCol) // Globex 75% line
- Globex_line_50 := line.new(x1=GlobexSessionStart, y1=Globex_50, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=Globex_50, color=i_GlobexLevelCol) // Globex 50% line
- Globex_line_25 := line.new(x1=GlobexSessionStart, y1=Globex_25, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=Globex_25, color=i_GlobexLevelCol) // Globex 25% line
- Globex_line_lo := line.new(x1=GlobexSessionStart, y1=Globex_lo, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=Globex_lo, color=i_GlobexLevelCol) // Globex Low line
- GlobexHighLabel := label.new(x=GlobexSessionStart, y=Globex_hi, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Globex75Label := label.new(x=GlobexSessionStart, y=Globex_75, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Globex50Label := label.new(x=GlobexSessionStart, y=Globex_50, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Globex25Label := label.new(x=GlobexSessionStart, y=Globex_25, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- GlobexLowLabel := label.new(x=GlobexSessionStart, y=Globex_lo, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- label.set_tooltip(GlobexHighLabel, "Globex High")
- label.set_tooltip(Globex75Label, "Globex 75%")
- label.set_tooltip(Globex50Label, "Globex 50%")
- label.set_tooltip(Globex25Label, "Globex 25%")
- label.set_tooltip(GlobexLowLabel, "Globex Low")
- else if GlobexSession
- // We are in allowed GlobexSession hours; track hi/lo.
- Globex_hi := math.max(srcHi, Globex_hi)
- Globex_lo := math.min(srcLo, Globex_lo)
- if (Globex_hi > Globex_hi[1])
- Globex_75 := Globex_lo+(Globex_hi-Globex_lo)*0.75
- Globex_50 := Globex_lo+(Globex_hi-Globex_lo)*0.5
- Globex_25 := Globex_lo+(Globex_hi-Globex_lo)*0.25
- if showGlobexDrawings
- line.set_xy1(id=Globex_line_hi, x=time, y=Globex_hi)
- line.set_xy2(id=Globex_line_hi, x=CashSessionEndTime, y=Globex_hi)
- line.set_xy1(id=Globex_line_75, x=GlobexSessionStart, y=Globex_75)
- line.set_xy2(id=Globex_line_75, x=CashSessionEndTime, y=Globex_75)
- line.set_xy1(id=Globex_line_50, x=GlobexSessionStart, y=Globex_50)
- line.set_xy2(id=Globex_line_50, x=CashSessionEndTime, y=Globex_50)
- line.set_xy1(id=Globex_line_25, x=GlobexSessionStart, y=Globex_25)
- line.set_xy2(id=Globex_line_25, x=CashSessionEndTime, y=Globex_25)
- if showLabels
- label.set_xy(id=GlobexHighLabel, x=CashSessionEndTime, y=Globex_hi)
- label.set_xy(id=Globex75Label, x=CashSessionEndTime, y=Globex_75)
- label.set_xy(id=Globex50Label, x=CashSessionEndTime, y=Globex_50)
- label.set_xy(id=Globex25Label, x=CashSessionEndTime, y=Globex_25)
- label.set_xy(id=GlobexLowLabel, x=CashSessionEndTime, y=Globex_lo)
- if (Globex_lo < Globex_lo[1])
- Globex_75 := Globex_lo+(Globex_hi-Globex_lo)*0.75
- Globex_50 := Globex_lo+(Globex_hi-Globex_lo)*0.5
- Globex_25 := Globex_lo+(Globex_hi-Globex_lo)*0.25
- if showGlobexDrawings
- line.set_xy1(id=Globex_line_lo, x=time, y=Globex_lo)
- line.set_xy2(id=Globex_line_lo, x=CashSessionEndTime, y=Globex_lo)
- line.set_xy1(id=Globex_line_75, x=GlobexSessionStart, y=Globex_75)
- line.set_xy2(id=Globex_line_75, x=CashSessionEndTime, y=Globex_75)
- line.set_xy1(id=Globex_line_50, x=GlobexSessionStart, y=Globex_50)
- line.set_xy2(id=Globex_line_50, x=CashSessionEndTime, y=Globex_50)
- line.set_xy1(id=Globex_line_25, x=GlobexSessionStart, y=Globex_25)
- line.set_xy2(id=Globex_line_25, x=CashSessionEndTime, y=Globex_25)
- if showLabels
- label.set_xy(id=GlobexHighLabel, x=CashSessionEndTime, y=Globex_hi)
- label.set_xy(id=Globex75Label, x=CashSessionEndTime, y=Globex_75)
- label.set_xy(id=Globex50Label, x=CashSessionEndTime, y=Globex_50)
- label.set_xy(id=Globex25Label, x=CashSessionEndTime, y=Globex_25)
- label.set_xy(id=GlobexLowLabel, x=CashSessionEndTime, y=Globex_lo)
- // END Globex Session Code
- // Begin Asian Session Code
- if sessionBegins(i_AsianSession) // When a new Asia Session is started
- AsianSessionStart := time // Store the Session Starting timestamp
- CashSessionEndTime := timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- if CashSessionEndTime < AsianSessionStart // If the CashSessionEndTime is in the past, then add 1 day
- CashSessionEndTime := CashSessionEndTime+86400000 // Add 1 day, so level lines will be drawn to the right like they should
- AsianORStart := AsianSessionStart + (i_AsianORoffset * 60000) // Add the offset in milliseconds
- AsianOREnd := AsianORStart + 3600000 // Add one hour in milliseconds
- Asian_hi := srcHi
- Asian_lo := srcLo
- Asian_75 := Asian_lo+(Asian_hi-Asian_lo)*0.75
- Asian_50 := Asian_lo+(Asian_hi-Asian_lo)*0.5
- Asian_25 := Asian_lo+(Asian_hi-Asian_lo)*0.25
- if showAsianDrawings
- // Keep or Remove all historic levels
- if showTodaysDrawings // If true then delete all old objects
- line.delete(Asian_line_hi[1])
- line.delete(Asian_line_75[1])
- line.delete(Asian_line_50[1])
- line.delete(Asian_line_25[1])
- line.delete(Asian_line_lo[1])
- label.delete(AsianHighLabel[1])
- label.delete(Asian75Label[1])
- label.delete(Asian50Label[1])
- label.delete(Asian25Label[1])
- label.delete(AsianLowLabel[1])
- if showAsianOR // Delete historic Opening Range objects
- box.delete(AsianORBox[1])
- line.delete(AsianOR_line_hi[1])
- line.delete(AsianOR_line_lo[1])
- label.delete(AsianORLabelHigh[1])
- label.delete(AsianORLabelLow[1])
- if showAsianORStdev // Delete historic Opening Range STDEV objects
- label.delete(AsianORLabelHigh10[1])
- label.delete(AsianORLabelHigh20[1])
- label.delete(AsianORLabelHigh30[1])
- label.delete(AsianORLabelLow10[1])
- label.delete(AsianORLabelLow20[1])
- label.delete(AsianORLabelLow30[1])
- line.delete(AsianOR_line_hi10[1])
- line.delete(AsianOR_line_hi15[1])
- line.delete(AsianOR_line_hi175[1])
- line.delete(AsianOR_line_hi20[1])
- line.delete(AsianOR_line_hi225[1])
- line.delete(AsianOR_line_hi25[1])
- line.delete(AsianOR_line_hi30[1])
- line.delete(AsianOR_line_lo10[1])
- line.delete(AsianOR_line_lo15[1])
- line.delete(AsianOR_line_lo175[1])
- line.delete(AsianOR_line_lo20[1])
- line.delete(AsianOR_line_lo225[1])
- line.delete(AsianOR_line_lo25[1])
- line.delete(AsianOR_line_lo30[1])
- // Create new objects for Todays trading
- Asian_line_hi := line.new(x1=AsianSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_AsianLevelCol) // Asian High line
- Asian_line_75 := line.new(x1=AsianSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_AsianLevelCol) // Asian 75% line
- Asian_line_50 := line.new(x1=AsianSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_AsianLevelCol) // Asian 50% line
- Asian_line_25 := line.new(x1=AsianSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_AsianLevelCol) // Asian 25% line
- Asian_line_lo := line.new(x1=AsianSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_AsianLevelCol) // Asian Low line
- AsianHighLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Asian75Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Asian50Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- Asian25Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianLowLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- label.set_tooltip(AsianHighLabel, "Asian High")
- label.set_tooltip(Asian75Label, "Asian 75%")
- label.set_tooltip(Asian50Label, "Asian 50%")
- label.set_tooltip(Asian25Label, "Asian 25%")
- label.set_tooltip(AsianLowLabel, "Asian Low")
- if showAsianOR
- AsianOR_line_hi := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianSessionCol) // Opening Range High
- AsianOR_line_lo := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_AsianSessionCol) // Opening Range Low
- AsianOR_line_hi10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- AsianOR_line_hi15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- AsianOR_line_hi175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- AsianOR_line_hi20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- AsianOR_line_hi225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- AsianOR_line_hi25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- AsianOR_line_hi30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- AsianOR_line_lo10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- AsianOR_line_lo15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- AsianOR_line_lo175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- AsianOR_line_lo20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- AsianOR_line_lo225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- AsianOR_line_lo25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- AsianOR_line_lo30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- AsianORBox := box.new(left=AsianORStart, top=na, right=AsianOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_AsianSessionCol, 100), bgcolor=color.new(i_AsianSessionCol, 70))
- AsianORLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelHigh := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelHigh10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelHigh20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelHigh30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelLow := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelLow10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelLow20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- AsianORLabelLow30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- else if AsianSession
- // We are in allowed AsianSession hours; track hi/lo.
- Asian_hi := math.max(srcHi, Asian_hi)
- Asian_lo := math.min(srcLo, Asian_lo)
- if (Asian_hi > Asian_hi[1])
- Asian_75 := Asian_lo+(Asian_hi-Asian_lo)*0.75
- Asian_50 := Asian_lo+(Asian_hi-Asian_lo)*0.5
- Asian_25 := Asian_lo+(Asian_hi-Asian_lo)*0.25
- if showAsianOR and time <= AsianOREnd
- // Plot the 1st Hour Box
- box.set_lefttop(id=AsianORBox, left=AsianORStart, top=Asian_hi)
- box.set_rightbottom(id=AsianORBox, right=AsianOREnd, bottom=Asian_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=AsianOR_line_hi, x=AsianORStart, y=Asian_hi)
- line.set_xy2(id=AsianOR_line_hi, x=CashSessionEndTime, y=Asian_hi)
- line.set_xy1(id=AsianOR_line_lo, x=AsianORStart, y=Asian_lo)
- line.set_xy2(id=AsianOR_line_lo, x=CashSessionEndTime, y=Asian_lo)
- if showLabels
- label.set_text(id=AsianORLabelHigh, text="OR High")
- label.set_xy(id=AsianORLabelHigh, x=CashSessionEndTime, y=Asian_hi)
- label.set_text(id=AsianORLabelLow, text="OR Low")
- label.set_xy(id=AsianORLabelLow, x=CashSessionEndTime, y=Asian_lo)
- if showAsianDrawings
- line.set_xy1(id=Asian_line_hi, x=time, y=Asian_hi)
- line.set_xy2(id=Asian_line_hi, x=CashSessionEndTime, y=Asian_hi)
- line.set_xy1(id=Asian_line_75, x=AsianSessionStart, y=Asian_75)
- line.set_xy2(id=Asian_line_75, x=CashSessionEndTime, y=Asian_75)
- line.set_xy1(id=Asian_line_50, x=AsianSessionStart, y=Asian_50)
- line.set_xy2(id=Asian_line_50, x=CashSessionEndTime, y=Asian_50)
- line.set_xy1(id=Asian_line_25, x=AsianSessionStart, y=Asian_25)
- line.set_xy2(id=Asian_line_25, x=CashSessionEndTime, y=Asian_25)
- if showLabels
- label.set_xy(id=AsianHighLabel, x=CashSessionEndTime, y=Asian_hi)
- label.set_xy(id=Asian75Label, x=CashSessionEndTime, y=Asian_75)
- label.set_xy(id=Asian50Label, x=CashSessionEndTime, y=Asian_50)
- label.set_xy(id=Asian25Label, x=CashSessionEndTime, y=Asian_25)
- label.set_xy(id=AsianLowLabel, x=CashSessionEndTime, y=Asian_lo)
- if (Asian_lo < Asian_lo[1])
- Asian_75 := Asian_lo+(Asian_hi-Asian_lo)*0.75
- Asian_50 := Asian_lo+(Asian_hi-Asian_lo)*0.5
- Asian_25 := Asian_lo+(Asian_hi-Asian_lo)*0.25
- if showAsianOR and time <= AsianOREnd
- // Plot the 1st Hour Box
- box.set_lefttop(id=AsianORBox, left=AsianORStart, top=Asian_hi)
- box.set_rightbottom(id=AsianORBox, right=AsianOREnd, bottom=Asian_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=AsianOR_line_hi, x=AsianORStart, y=Asian_hi)
- line.set_xy2(id=AsianOR_line_hi, x=CashSessionEndTime, y=Asian_hi)
- line.set_xy1(id=AsianOR_line_lo, x=AsianORStart, y=Asian_lo)
- line.set_xy2(id=AsianOR_line_lo, x=CashSessionEndTime, y=Asian_lo)
- if showLabels
- label.set_text(id=AsianORLabelHigh, text="OR High")
- label.set_xy(id=AsianORLabelHigh, x=CashSessionEndTime, y=Asian_hi)
- label.set_text(id=AsianORLabelLow, text="OR Low")
- label.set_xy(id=AsianORLabelLow, x=CashSessionEndTime, y=Asian_lo)
- if showAsianDrawings
- line.set_xy1(id=Asian_line_lo, x=time, y=Asian_lo)
- line.set_xy2(id=Asian_line_lo, x=CashSessionEndTime, y=Asian_lo)
- line.set_xy1(id=Asian_line_75, x=AsianSessionStart, y=Asian_75)
- line.set_xy2(id=Asian_line_75, x=CashSessionEndTime, y=Asian_75)
- line.set_xy1(id=Asian_line_50, x=AsianSessionStart, y=Asian_50)
- line.set_xy2(id=Asian_line_50, x=CashSessionEndTime, y=Asian_50)
- line.set_xy1(id=Asian_line_25, x=AsianSessionStart, y=Asian_25)
- line.set_xy2(id=Asian_line_25, x=CashSessionEndTime, y=Asian_25)
- if showLabels
- label.set_xy(id=AsianHighLabel, x=CashSessionEndTime, y=Asian_hi)
- label.set_xy(id=Asian75Label, x=CashSessionEndTime, y=Asian_75)
- label.set_xy(id=Asian50Label, x=CashSessionEndTime, y=Asian_50)
- label.set_xy(id=Asian25Label, x=CashSessionEndTime, y=Asian_25)
- label.set_xy(id=AsianLowLabel, x=CashSessionEndTime, y=Asian_lo)
- if showAsianOR and time == AsianOREnd and showAsianORStdev // (At the exact end of Asian OR, calculate and draw the STDev levels )
- // Plot the Positive IB STDEVs
- line.set_xy1(id=AsianOR_line_hi10, x=AsianOREnd+1800000, y=Asian_hi+(Asian_hi-Asian_lo))
- line.set_xy2(id=AsianOR_line_hi10, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo))
- line.set_xy1(id=AsianOR_line_hi15, x=AsianOREnd+3600000, y=Asian_hi+(Asian_hi-Asian_lo)*1.5)
- line.set_xy2(id=AsianOR_line_hi15, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*1.5)
- line.set_xy1(id=AsianOR_line_hi175, x=AsianOREnd+5000000, y=Asian_hi+(Asian_hi-Asian_lo)*1.75)
- line.set_xy2(id=AsianOR_line_hi175, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*1.75)
- line.set_xy1(id=AsianOR_line_hi20, x=AsianOREnd+7200000, y=Asian_hi+(Asian_hi-Asian_lo)*2)
- line.set_xy2(id=AsianOR_line_hi20, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*2)
- line.set_xy1(id=AsianOR_line_hi225, x=AsianOREnd+8800000, y=Asian_hi+(Asian_hi-Asian_lo)*2.25)
- line.set_xy2(id=AsianOR_line_hi225, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*2.25)
- line.set_xy1(id=AsianOR_line_hi25, x=AsianOREnd+10800000, y=Asian_hi+(Asian_hi-Asian_lo)*2.5)
- line.set_xy2(id=AsianOR_line_hi25, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*2.5)
- line.set_xy1(id=AsianOR_line_hi30, x=AsianOREnd+12800000, y=Asian_hi+(Asian_hi-Asian_lo)*3)
- line.set_xy2(id=AsianOR_line_hi30, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*3)
- // Plot the Negative IB STDEVs
- line.set_xy1(id=AsianOR_line_lo10, x=AsianOREnd+1800000, y=Asian_lo-(Asian_hi-Asian_lo))
- line.set_xy2(id=AsianOR_line_lo10, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo))
- line.set_xy1(id=AsianOR_line_lo15, x=AsianOREnd+3600000, y=Asian_lo-(Asian_hi-Asian_lo)*1.5)
- line.set_xy2(id=AsianOR_line_lo15, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*1.5)
- line.set_xy1(id=AsianOR_line_lo175, x=AsianOREnd+5000000, y=Asian_lo-(Asian_hi-Asian_lo)*1.75)
- line.set_xy2(id=AsianOR_line_lo175, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*1.75)
- line.set_xy1(id=AsianOR_line_lo20, x=AsianOREnd+7200000, y=Asian_lo-(Asian_hi-Asian_lo)*2)
- line.set_xy2(id=AsianOR_line_lo20, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*2)
- line.set_xy1(id=AsianOR_line_lo225, x=AsianOREnd+8800000, y=Asian_lo-(Asian_hi-Asian_lo)*2.25)
- line.set_xy2(id=AsianOR_line_lo225, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*2.25)
- line.set_xy1(id=AsianOR_line_lo25, x=AsianOREnd+10800000, y=Asian_lo-(Asian_hi-Asian_lo)*2.5)
- line.set_xy2(id=AsianOR_line_lo25, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*2.5)
- line.set_xy1(id=AsianOR_line_lo30, x=AsianOREnd+12800000, y=Asian_lo-(Asian_hi-Asian_lo)*3)
- line.set_xy2(id=AsianOR_line_lo30, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*3)
- // Plot the IB STDEV Labels
- if showLabels
- label.set_text(id=AsianORLabelHigh10, text="1.0 OR")
- label.set_xy(id=AsianORLabelHigh10, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo))
- label.set_text(id=AsianORLabelHigh20, text="2.0 OR")
- label.set_xy(id=AsianORLabelHigh20, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*2)
- label.set_text(id=AsianORLabelHigh30, text="3.0 OR")
- label.set_xy(id=AsianORLabelHigh30, x=CashSessionEndTime, y=Asian_hi+(Asian_hi-Asian_lo)*3)
- label.set_text(id=AsianORLabelLow10, text="-1.0 OR")
- label.set_xy(id=AsianORLabelLow10, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo))
- label.set_text(id=AsianORLabelLow20, text="-2.0 OR")
- label.set_xy(id=AsianORLabelLow20, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*2)
- label.set_text(id=AsianORLabelLow30, text="-3.0 OR")
- label.set_xy(id=AsianORLabelLow30, x=CashSessionEndTime, y=Asian_lo-(Asian_hi-Asian_lo)*3)
- // END Asian Session Code
- // ***
- // Begin London Session Code
- if sessionBegins(i_LondonSession) // When a new London Session is started
- LondonSessionStart := time // Store the Session Starting timestamp
- CashSessionEndTime := timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- if CashSessionEndTime < LondonSessionStart // If the CashSessionEndTime is in the past, then add 1 day
- CashSessionEndTime := CashSessionEndTime+86400000 // Add 1 day, so level lines will be drawn to the right like they should
- LondonORStart := LondonSessionStart + (i_LondonORoffset * 60000) // Add the offset in milliseconds
- LondonOREnd := LondonORStart + 3600000 // Add one hour in milliseconds
- // We are entering London Session hours; reset hi/lo.
- London_hi := srcHi
- London_lo := srcLo
- London_75 := London_lo+(London_hi-London_lo)*0.75
- London_50 := London_lo+(London_hi-London_lo)*0.5
- London_25 := London_lo+(London_hi-London_lo)*0.25
- if showLondonDrawings
- // Keep or Remove all historic levels
- if showTodaysDrawings // If true then delete all old objects
- line.delete(London_line_hi[1])
- line.delete(London_line_75[1])
- line.delete(London_line_50[1])
- line.delete(London_line_25[1])
- line.delete(London_line_lo[1])
- label.delete(LondonHighLabel[1])
- label.delete(London75Label[1])
- label.delete(London50Label[1])
- label.delete(London25Label[1])
- label.delete(LondonLowLabel[1])
- if showLondonOR // Delete historic Opening Range objects
- box.delete(LondonORBox[1])
- line.delete(LondonOR_line_hi[1])
- line.delete(LondonOR_line_lo[1])
- label.delete(LondonORLabelHigh[1])
- label.delete(LondonORLabelLow[1])
- if showLondonORStdev // Delete historic Opening Range STDEV objects
- label.delete(LondonORLabelHigh10[1])
- label.delete(LondonORLabelHigh20[1])
- label.delete(LondonORLabelHigh30[1])
- label.delete(LondonORLabelLow10[1])
- label.delete(LondonORLabelLow20[1])
- label.delete(LondonORLabelLow30[1])
- line.delete(LondonOR_line_hi10[1])
- line.delete(LondonOR_line_hi15[1])
- line.delete(LondonOR_line_hi175[1])
- line.delete(LondonOR_line_hi20[1])
- line.delete(LondonOR_line_hi225[1])
- line.delete(LondonOR_line_hi25[1])
- line.delete(LondonOR_line_hi30[1])
- line.delete(LondonOR_line_lo10[1])
- line.delete(LondonOR_line_lo15[1])
- line.delete(LondonOR_line_lo175[1])
- line.delete(LondonOR_line_lo20[1])
- line.delete(LondonOR_line_lo225[1])
- line.delete(LondonOR_line_lo25[1])
- line.delete(LondonOR_line_lo30[1])
- // Create the new objects for Todays session
- London_line_hi := line.new(x1=LondonSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_LondonLevelCol) // London High line
- London_line_75 := line.new(x1=LondonSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_LondonLevelCol) // London 75% line
- London_line_50 := line.new(x1=LondonSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_LondonLevelCol) // London 50% line
- London_line_25 := line.new(x1=LondonSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_LondonLevelCol) // London 25% line
- London_line_lo := line.new(x1=LondonSessionStart, y1=close[1], x2=CashSessionEndTime, xloc=xloc.bar_time, y2=close[1], color=i_LondonLevelCol) // London Low line
- LondonHighLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- London75Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- London50Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- London25Label := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonLowLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- label.set_tooltip(LondonHighLabel, "London High")
- label.set_tooltip(London75Label, "London 75%")
- label.set_tooltip(London50Label, "London 50%")
- label.set_tooltip(London25Label, "London 25%")
- label.set_tooltip(LondonLowLabel, "London Low")
- if showLondonOR
- // The London 1st hour Opening Range initialization
- LondonOR_line_hi := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_LondonSessionCol) // Opening Range High
- LondonOR_line_lo := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_LondonSessionCol) // Opening Range Low
- LondonOR_line_hi10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- LondonOR_line_hi15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- LondonOR_line_hi175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- LondonOR_line_hi20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- LondonOR_line_hi225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- LondonOR_line_hi25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- LondonOR_line_hi30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- LondonOR_line_lo10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- LondonOR_line_lo15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- LondonOR_line_lo175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- LondonOR_line_lo20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- LondonOR_line_lo225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- LondonOR_line_lo25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- LondonOR_line_lo30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- LondonORBox := box.new(left=LondonORStart, top=na, right=LondonOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_LondonSessionCol, 100), bgcolor=color.new(i_LondonSessionCol, 70))
- LondonORLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelHigh := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelHigh10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelHigh20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelHigh30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelLow := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelLow10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelLow20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- LondonORLabelLow30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- else if LondonSession
- // We are in allowed LondonSession hours; track hi/lo.
- London_hi := math.max(srcHi, London_hi)
- London_lo := math.min(srcLo, London_lo)
- if (London_hi > London_hi[1])
- London_75 := London_lo+(London_hi-London_lo)*0.75
- London_50 := London_lo+(London_hi-London_lo)*0.5
- London_25 := London_lo+(London_hi-London_lo)*0.25
- if showLondonOR and time <= LondonOREnd
- // Plot the 1st Hour Box
- box.set_lefttop(id=LondonORBox, left=LondonORStart, top=London_hi)
- box.set_rightbottom(id=LondonORBox, right=LondonOREnd, bottom=London_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=LondonOR_line_hi, x=LondonORStart, y=London_hi)
- line.set_xy2(id=LondonOR_line_hi, x=CashSessionEndTime, y=London_hi)
- line.set_xy1(id=LondonOR_line_lo, x=LondonORStart, y=London_lo)
- line.set_xy2(id=LondonOR_line_lo, x=CashSessionEndTime, y=London_lo)
- if showLabels
- label.set_text(id=LondonORLabelHigh, text="OR High")
- label.set_xy(id=LondonORLabelHigh, x=CashSessionEndTime, y=London_hi)
- label.set_text(id=LondonORLabelLow, text="OR Low")
- label.set_xy(id=LondonORLabelLow, x=CashSessionEndTime, y=London_lo)
- if showLondonDrawings
- line.set_xy1(id=London_line_hi, x=time, y=London_hi)
- line.set_xy2(id=London_line_hi, x=CashSessionEndTime, y=London_hi)
- line.set_xy1(id=London_line_75, x=LondonSessionStart, y=London_75)
- line.set_xy2(id=London_line_75, x=CashSessionEndTime, y=London_75)
- line.set_xy1(id=London_line_50, x=LondonSessionStart, y=London_50)
- line.set_xy2(id=London_line_50, x=CashSessionEndTime, y=London_50)
- line.set_xy1(id=London_line_25, x=LondonSessionStart, y=London_25)
- line.set_xy2(id=London_line_25, x=CashSessionEndTime, y=London_25)
- if showLabels
- label.set_xy(id=LondonHighLabel, x=CashSessionEndTime, y=London_hi)
- label.set_xy(id=London75Label, x=CashSessionEndTime, y=London_75)
- label.set_xy(id=London50Label, x=CashSessionEndTime, y=London_50)
- label.set_xy(id=London25Label, x=CashSessionEndTime, y=London_25)
- label.set_xy(id=LondonLowLabel, x=CashSessionEndTime, y=London_lo)
- if (London_lo < London_lo[1])
- London_75 := London_lo+(London_hi-London_lo)*0.75
- London_50 := London_lo+(London_hi-London_lo)*0.5
- London_25 := London_lo+(London_hi-London_lo)*0.25
- if showLondonOR and time <= LondonOREnd
- // Plot the 1st Hour Box
- box.set_lefttop(id=LondonORBox, left=LondonORStart, top=London_hi)
- box.set_rightbottom(id=LondonORBox, right=LondonOREnd, bottom=London_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=LondonOR_line_hi, x=LondonORStart, y=London_hi)
- line.set_xy2(id=LondonOR_line_hi, x=CashSessionEndTime, y=London_hi)
- line.set_xy1(id=LondonOR_line_lo, x=LondonORStart, y=London_lo)
- line.set_xy2(id=LondonOR_line_lo, x=CashSessionEndTime, y=London_lo)
- if showLabels
- label.set_text(id=LondonORLabelHigh, text="OR High")
- label.set_xy(id=LondonORLabelHigh, x=CashSessionEndTime, y=London_hi)
- label.set_text(id=LondonORLabelLow, text="OR Low")
- label.set_xy(id=LondonORLabelLow, x=CashSessionEndTime, y=London_lo)
- if showLondonDrawings
- line.set_xy1(id=London_line_lo, x=time, y=London_lo)
- line.set_xy2(id=London_line_lo, x=CashSessionEndTime, y=London_lo)
- line.set_xy1(id=London_line_75, x=LondonSessionStart, y=London_75)
- line.set_xy2(id=London_line_75, x=CashSessionEndTime, y=London_75)
- line.set_xy1(id=London_line_50, x=LondonSessionStart, y=London_50)
- line.set_xy2(id=London_line_50, x=CashSessionEndTime, y=London_50)
- line.set_xy1(id=London_line_25, x=LondonSessionStart, y=London_25)
- line.set_xy2(id=London_line_25, x=CashSessionEndTime, y=London_25)
- if showLabels
- label.set_xy(id=LondonHighLabel, x=CashSessionEndTime, y=London_hi)
- label.set_xy(id=London75Label, x=CashSessionEndTime, y=London_75)
- label.set_xy(id=London50Label, x=CashSessionEndTime, y=London_50)
- label.set_xy(id=London25Label, x=CashSessionEndTime, y=London_25)
- label.set_xy(id=LondonLowLabel, x=CashSessionEndTime, y=London_lo)
- if showLondonOR and time == LondonOREnd and showLondonORStdev // (At the exact end of London OR, calculate and draw the STDev levels )
- // Plot the Positive IB STDEVs
- line.set_xy1(id=LondonOR_line_hi10, x=LondonOREnd+1800000, y=London_hi+(London_hi-London_lo))
- line.set_xy2(id=LondonOR_line_hi10, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo))
- line.set_xy1(id=LondonOR_line_hi15, x=LondonOREnd+3600000, y=London_hi+(London_hi-London_lo)*1.5)
- line.set_xy2(id=LondonOR_line_hi15, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*1.5)
- line.set_xy1(id=LondonOR_line_hi175, x=LondonOREnd+5000000, y=London_hi+(London_hi-London_lo)*1.75)
- line.set_xy2(id=LondonOR_line_hi175, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*1.75)
- line.set_xy1(id=LondonOR_line_hi20, x=LondonOREnd+7200000, y=London_hi+(London_hi-London_lo)*2)
- line.set_xy2(id=LondonOR_line_hi20, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*2)
- line.set_xy1(id=LondonOR_line_hi225, x=LondonOREnd+8800000, y=London_hi+(London_hi-London_lo)*2.25)
- line.set_xy2(id=LondonOR_line_hi225, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*2.25)
- line.set_xy1(id=LondonOR_line_hi25, x=LondonOREnd+10800000, y=London_hi+(London_hi-London_lo)*2.5)
- line.set_xy2(id=LondonOR_line_hi25, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*2.5)
- line.set_xy1(id=LondonOR_line_hi30, x=LondonOREnd+12800000, y=London_hi+(London_hi-London_lo)*3)
- line.set_xy2(id=LondonOR_line_hi30, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*3)
- // Plot the Negative IB STDEVs
- line.set_xy1(id=LondonOR_line_lo10, x=LondonOREnd+1800000, y=London_lo-(London_hi-London_lo))
- line.set_xy2(id=LondonOR_line_lo10, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo))
- line.set_xy1(id=LondonOR_line_lo15, x=LondonOREnd+3600000, y=London_lo-(London_hi-London_lo)*1.5)
- line.set_xy2(id=LondonOR_line_lo15, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*1.5)
- line.set_xy1(id=LondonOR_line_lo175, x=LondonOREnd+5000000, y=London_lo-(London_hi-London_lo)*1.75)
- line.set_xy2(id=LondonOR_line_lo175, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*1.75)
- line.set_xy1(id=LondonOR_line_lo20, x=LondonOREnd+7200000, y=London_lo-(London_hi-London_lo)*2)
- line.set_xy2(id=LondonOR_line_lo20, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*2)
- line.set_xy1(id=LondonOR_line_lo225, x=LondonOREnd+8800000, y=London_lo-(London_hi-London_lo)*2.25)
- line.set_xy2(id=LondonOR_line_lo225, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*2.25)
- line.set_xy1(id=LondonOR_line_lo25, x=LondonOREnd+10800000, y=London_lo-(London_hi-London_lo)*2.5)
- line.set_xy2(id=LondonOR_line_lo25, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*2.5)
- line.set_xy1(id=LondonOR_line_lo30, x=LondonOREnd+12800000, y=London_lo-(London_hi-London_lo)*3)
- line.set_xy2(id=LondonOR_line_lo30, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*3)
- // Plot the IB STDEV Labels
- if showLabels
- label.set_text(id=LondonORLabelHigh10, text="1.0 OR")
- label.set_xy(id=LondonORLabelHigh10, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo))
- label.set_text(id=LondonORLabelHigh20, text="2.0 OR")
- label.set_xy(id=LondonORLabelHigh20, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*2)
- label.set_text(id=LondonORLabelHigh30, text="3.0 OR")
- label.set_xy(id=LondonORLabelHigh30, x=CashSessionEndTime, y=London_hi+(London_hi-London_lo)*3)
- label.set_text(id=LondonORLabelLow10, text="-1.0 OR")
- label.set_xy(id=LondonORLabelLow10, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo))
- label.set_text(id=LondonORLabelLow20, text="-2.0 OR")
- label.set_xy(id=LondonORLabelLow20, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*2)
- label.set_text(id=LondonORLabelLow30, text="-3.0 OR")
- label.set_xy(id=LondonORLabelLow30, x=CashSessionEndTime, y=London_lo-(London_hi-London_lo)*3)
- // END London Session Code
- // ***
- // Begin NewYork Session Code
- if sessionBegins(i_NewYorkSession) // When a new NewYork Session is started
- NewYorkSessionStart := time // Store the Session Starting timestamp
- CashSessionEndTime := timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- if CashSessionEndTime < NewYorkSessionStart // If the CashSessionEndTime is in the past, then add 1 day
- CashSessionEndTime := CashSessionEndTime+86400000 // Add 1 day, so level lines will be drawn to the right like they should
- NewYorkORStart := NewYorkSessionStart + (i_NewYorkORoffset * 60000) // Add the offset in milliseconds
- NewYorkOREnd := NewYorkORStart + 3600000 // Add one hour in milliseconds
- // We are entering NewYork Session hours; reset hi/lo.
- NewYork_hi := srcHi
- NewYork_lo := srcLo
- NewYork_75 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.75
- NewYork_50 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.5
- NewYork_25 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.25
- // Initialize the drawings for today
- if showNewYorkDrawings
- // Keep or Remove all historic levels
- if showTodaysDrawings // If true then delete all old objects
- line.delete(NewYork_line_hi[1])
- line.delete(NewYork_line_75[1])
- line.delete(NewYork_line_50[1])
- line.delete(NewYork_line_25[1])
- line.delete(NewYork_line_lo[1])
- label.delete(NewYorkHighLabel[1])
- label.delete(NewYork75Label[1])
- label.delete(NewYork50Label[1])
- label.delete(NewYork25Label[1])
- label.delete(NewYorkLowLabel[1])
- if showNewYorkOR // Delete historic Opening Range objects
- box.delete(NewYorkORBox[1])
- line.delete(NewYorkOR_line_hi[1])
- line.delete(NewYorkOR_line_mid[1])
- line.delete(NewYorkOR_line_lo[1])
- label.delete(NewYorkORLabelHigh[1])
- label.delete(NewYorkORLabelLow[1])
- label.delete(NewYorkORLabelMid[1])
- if showNewYorkORStdev // Delete historic Opening Range STDEV objects
- label.delete(NewYorkORLabelHigh05[1])
- label.delete(NewYorkORLabelHigh10[1])
- label.delete(NewYorkORLabelHigh20[1])
- label.delete(NewYorkORLabelHigh30[1])
- label.delete(NewYorkORLabelLow05[1])
- label.delete(NewYorkORLabelLow10[1])
- label.delete(NewYorkORLabelLow20[1])
- label.delete(NewYorkORLabelLow30[1])
- line.delete(NewYorkOR_line_hi05[1])
- line.delete(NewYorkOR_line_hi10[1])
- line.delete(NewYorkOR_line_hi15[1])
- line.delete(NewYorkOR_line_hi175[1])
- line.delete(NewYorkOR_line_hi20[1])
- line.delete(NewYorkOR_line_hi225[1])
- line.delete(NewYorkOR_line_hi25[1])
- line.delete(NewYorkOR_line_hi30[1])
- line.delete(NewYorkOR_line_lo05[1])
- line.delete(NewYorkOR_line_lo10[1])
- line.delete(NewYorkOR_line_lo15[1])
- line.delete(NewYorkOR_line_lo175[1])
- line.delete(NewYorkOR_line_lo20[1])
- line.delete(NewYorkOR_line_lo225[1])
- line.delete(NewYorkOR_line_lo25[1])
- line.delete(NewYorkOR_line_lo30[1])
- // Create new objects for today
- NewYork_line_hi := line.new(x1=NewYorkSessionStart, y1=NewYork_hi, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=NewYork_hi, color=i_NYLevelCol) // NewYork High line
- NewYork_line_75 := line.new(x1=NewYorkSessionStart, y1=NewYork_75, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=NewYork_75, color=i_NYLevelCol) // NewYork 75% line
- NewYork_line_50 := line.new(x1=NewYorkSessionStart, y1=NewYork_50, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=NewYork_50, color=i_NYLevelCol) // NewYork 50% line
- NewYork_line_25 := line.new(x1=NewYorkSessionStart, y1=NewYork_25, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=NewYork_25, color=i_NYLevelCol) // NewYork 25% line
- NewYork_line_lo := line.new(x1=NewYorkSessionStart, y1=NewYork_lo, x2=CashSessionEndTime, xloc=xloc.bar_time, y2=NewYork_lo, color=i_NYLevelCol) // NewYork Low line
- NewYorkHighLabel := label.new(x=NewYorkSessionStart, y=NewYork_hi, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYork75Label := label.new(x=NewYorkSessionStart, y=NewYork_75, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYork50Label := label.new(x=NewYorkSessionStart, y=NewYork_50, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYork25Label := label.new(x=NewYorkSessionStart, y=NewYork_25, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkLowLabel := label.new(x=NewYorkSessionStart, y=NewYork_lo, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- label.set_tooltip(NewYorkHighLabel, "New York High")
- label.set_tooltip(NewYork75Label, "New York 75%")
- label.set_tooltip(NewYork50Label, "New York 50%")
- label.set_tooltip(NewYork25Label, "New York 25%")
- label.set_tooltip(NewYorkLowLabel,"New York Low")
- if showNewYorkOR
- // The NewYork 1st hour Opening Range initialization
- NewYorkOR_line_hi := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range High
- NewYorkOR_line_mid := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range Middle
- NewYorkOR_line_lo := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=i_NYSessionCol) // Opening Range Low
- NewYorkORBox := box.new(left=NewYorkORStart, top=na, right=NewYorkOREnd, bottom=na, xloc=xloc.bar_time, border_width=2, border_color=color.new(i_NYSessionCol, 100), bgcolor=color.new(i_NYSessionCol, 70))
- //NewYorkORLabel := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelHigh := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelLow := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelMid := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- if showNewYorkORStdev
- NewYorkOR_line_hi05 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.teal) // Opening Range High 0.5 STDEV of OR
- NewYorkOR_line_hi10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 1.0 STDEV of OR
- NewYorkOR_line_hi15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.5 STDEV of OR
- NewYorkOR_line_hi175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 1.75 STDEV of OR
- NewYorkOR_line_hi20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 2.0 STDEV of OR
- NewYorkOR_line_hi225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.25 STDEV of OR
- NewYorkOR_line_hi25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range High 2.5 STDEV of OR
- NewYorkOR_line_hi30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.green) // Opening Range High 3.0 STDEV of OR
- NewYorkOR_line_lo05 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.maroon) // Opening Range Low 0.5 STDEV of OR
- NewYorkOR_line_lo10 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 1.0 STDEV of OR
- NewYorkOR_line_lo15 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.5 STDEV of OR
- NewYorkOR_line_lo175 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 1.75 STDEV of OR
- NewYorkOR_line_lo20 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 2.0 STDEV of OR
- NewYorkOR_line_lo225 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.25 STDEV of OR
- NewYorkOR_line_lo25 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.gray) // Opening Range Low 2.5 STDEV of OR
- NewYorkOR_line_lo30 := line.new(x1=na, y1=na, x2=na, xloc=xloc.bar_time, y2=close, color=color.red) // Opening Range Low 3.0 STDEV of OR
- NewYorkORLabelHigh05 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelHigh10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelHigh20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelHigh30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelLow05 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelLow10 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelLow20 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- NewYorkORLabelLow30 := label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- else if NewYorkSession
- // We are in allowed NewYorkSession hours; track hi/lo.
- NewYork_hi := math.max(srcHi, NewYork_hi)
- NewYork_lo := math.min(srcLo, NewYork_lo)
- if (NewYork_hi > NewYork_hi[1])
- NewYork_75 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.75
- NewYork_50 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.5
- NewYork_25 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.25
- if showNewYorkOR and time <= NewYorkOREnd
- // Store the OR High and 50% - Needed for Alerts
- NewYorkHr1hi := NewYork_hi
- NewYorkHr1mid := NewYork_50
- // Plot the 1st Hour Box
- box.set_lefttop(id=NewYorkORBox, left=NewYorkORStart, top=NewYork_hi)
- box.set_rightbottom(id=NewYorkORBox, right=NewYorkOREnd, bottom=NewYork_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=NewYorkOR_line_hi, x=NewYorkORStart, y=NewYork_hi)
- line.set_xy2(id=NewYorkOR_line_hi, x=CashSessionEndTime, y=NewYork_hi)
- line.set_xy1(id=NewYorkOR_line_mid, x=NewYorkORStart+(time-NewYorkORStart), y=NewYork_50)
- line.set_xy2(id=NewYorkOR_line_mid, x=CashSessionEndTime, y=NewYork_50)
- line.set_xy1(id=NewYorkOR_line_lo, x=NewYorkORStart, y=NewYork_lo)
- line.set_xy2(id=NewYorkOR_line_lo, x=CashSessionEndTime, y=NewYork_lo)
- if showLabels
- label.set_text(id=NewYorkORLabelHigh, text="OR High")
- label.set_xy(id=NewYorkORLabelHigh, x=CashSessionEndTime, y=NewYork_hi)
- label.set_text(id=NewYorkORLabelMid, text="OR 50%")
- label.set_xy(id=NewYorkORLabelMid, x=CashSessionEndTime, y=NewYork_50)
- label.set_text(id=NewYorkORLabelLow, text="OR Low")
- label.set_xy(id=NewYorkORLabelLow, x=CashSessionEndTime, y=NewYork_lo)
- if showNewYorkDrawings
- line.set_xy1(id=NewYork_line_hi, x=time, y=NewYork_hi)
- line.set_xy2(id=NewYork_line_hi, x=CashSessionEndTime, y=NewYork_hi)
- line.set_xy1(id=NewYork_line_75, x=NewYorkSessionStart, y=NewYork_75)
- line.set_xy2(id=NewYork_line_75, x=CashSessionEndTime, y=NewYork_75)
- line.set_xy1(id=NewYork_line_50, x=NewYorkSessionStart, y=NewYork_50)
- line.set_xy2(id=NewYork_line_50, x=CashSessionEndTime, y=NewYork_50)
- line.set_xy1(id=NewYork_line_25, x=NewYorkSessionStart, y=NewYork_25)
- line.set_xy2(id=NewYork_line_25, x=CashSessionEndTime, y=NewYork_25)
- if showLabels
- label.set_xy(id=NewYorkHighLabel, x=CashSessionEndTime, y=NewYork_hi)
- label.set_xy(id=NewYork75Label, x=CashSessionEndTime, y=NewYork_75)
- label.set_xy(id=NewYork50Label, x=CashSessionEndTime, y=NewYork_50)
- label.set_xy(id=NewYork25Label, x=CashSessionEndTime, y=NewYork_25)
- label.set_xy(id=NewYorkLowLabel,x=CashSessionEndTime, y=NewYork_lo)
- if (NewYork_lo < NewYork_lo[1])
- NewYork_75 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.75
- NewYork_50 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.5
- NewYork_25 := NewYork_lo+(NewYork_hi-NewYork_lo)*0.25
- if showNewYorkOR and time <= NewYorkOREnd
- // Store the OR Low and 50% - needed for Alerts
- NewYorkHr1lo := NewYork_lo
- NewYorkHr1mid := NewYork_50
- // Plot the 1st Hour Box
- box.set_lefttop(id=NewYorkORBox, left=NewYorkORStart, top=NewYork_hi)
- box.set_rightbottom(id=NewYorkORBox, right=NewYorkOREnd, bottom=NewYork_lo)
- // Plot the 1st Hour hi/low Levels
- line.set_xy1(id=NewYorkOR_line_hi, x=NewYorkORStart, y=NewYork_hi)
- line.set_xy2(id=NewYorkOR_line_hi, x=CashSessionEndTime, y=NewYork_hi)
- line.set_xy1(id=NewYorkOR_line_mid, x=NewYorkORStart+(time-NewYorkORStart), y=NewYork_50)
- line.set_xy2(id=NewYorkOR_line_mid, x=CashSessionEndTime, y=NewYork_50)
- line.set_xy1(id=NewYorkOR_line_lo, x=NewYorkORStart, y=NewYork_lo)
- line.set_xy2(id=NewYorkOR_line_lo, x=CashSessionEndTime, y=NewYork_lo)
- if showLabels
- label.set_text(id=NewYorkORLabelHigh, text="OR High")
- label.set_xy(id=NewYorkORLabelHigh, x=CashSessionEndTime, y=NewYork_hi)
- label.set_text(id=NewYorkORLabelMid, text="OR 50%")
- label.set_xy(id=NewYorkORLabelMid, x=CashSessionEndTime, y=NewYork_50)
- label.set_text(id=NewYorkORLabelLow, text="OR Low")
- label.set_xy(id=NewYorkORLabelLow, x=CashSessionEndTime, y=NewYork_lo)
- if showNewYorkDrawings
- line.set_xy1(id=NewYork_line_lo, x=time, y=NewYork_lo)
- line.set_xy2(id=NewYork_line_lo, x=CashSessionEndTime, y=NewYork_lo)
- line.set_xy1(id=NewYork_line_75, x=NewYorkSessionStart, y=NewYork_75)
- line.set_xy2(id=NewYork_line_75, x=CashSessionEndTime, y=NewYork_75)
- line.set_xy1(id=NewYork_line_50, x=NewYorkSessionStart, y=NewYork_50)
- line.set_xy2(id=NewYork_line_50, x=CashSessionEndTime, y=NewYork_50)
- line.set_xy1(id=NewYork_line_25, x=NewYorkSessionStart, y=NewYork_25)
- line.set_xy2(id=NewYork_line_25, x=CashSessionEndTime, y=NewYork_25)
- if showLabels
- label.set_xy(id=NewYorkHighLabel, x=CashSessionEndTime, y=NewYork_hi)
- label.set_xy(id=NewYork75Label, x=CashSessionEndTime, y=NewYork_75)
- label.set_xy(id=NewYork50Label, x=CashSessionEndTime, y=NewYork_50)
- label.set_xy(id=NewYork25Label, x=CashSessionEndTime, y=NewYork_25)
- label.set_xy(id=NewYorkLowLabel, x=CashSessionEndTime, y=NewYork_lo)
- if showNewYorkOR and time == NewYorkOREnd and showNewYorkORStdev // (At the exact end of NewYork OR, calculate and draw the STDev levels )
- // Plot the Positive IB STDEVs
- line.set_xy1(id=NewYorkOR_line_hi05, x=NewYorkOREnd+1000000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*0.5)
- line.set_xy2(id=NewYorkOR_line_hi05, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*0.5)
- line.set_xy1(id=NewYorkOR_line_hi10, x=NewYorkOREnd+1800000, y=NewYork_hi+(NewYork_hi-NewYork_lo))
- line.set_xy2(id=NewYorkOR_line_hi10, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo))
- line.set_xy1(id=NewYorkOR_line_hi15, x=NewYorkOREnd+3600000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*1.5)
- line.set_xy2(id=NewYorkOR_line_hi15, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*1.5)
- line.set_xy1(id=NewYorkOR_line_hi175, x=NewYorkOREnd+5000000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*1.75)
- line.set_xy2(id=NewYorkOR_line_hi175, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*1.75)
- line.set_xy1(id=NewYorkOR_line_hi20, x=NewYorkOREnd+7200000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2)
- line.set_xy2(id=NewYorkOR_line_hi20, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2)
- line.set_xy1(id=NewYorkOR_line_hi225, x=NewYorkOREnd+8800000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2.25)
- line.set_xy2(id=NewYorkOR_line_hi225, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2.25)
- line.set_xy1(id=NewYorkOR_line_hi25, x=NewYorkOREnd+10800000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2.5)
- line.set_xy2(id=NewYorkOR_line_hi25, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2.5)
- line.set_xy1(id=NewYorkOR_line_hi30, x=NewYorkOREnd+12800000, y=NewYork_hi+(NewYork_hi-NewYork_lo)*3)
- line.set_xy2(id=NewYorkOR_line_hi30, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*3)
- // Plot the Negative IB STDEVs
- line.set_xy1(id=NewYorkOR_line_lo05, x=NewYorkOREnd+1000000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*0.5)
- line.set_xy2(id=NewYorkOR_line_lo05, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*0.5)
- line.set_xy1(id=NewYorkOR_line_lo10, x=NewYorkOREnd+1800000, y=NewYork_lo-(NewYork_hi-NewYork_lo))
- line.set_xy2(id=NewYorkOR_line_lo10, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo))
- line.set_xy1(id=NewYorkOR_line_lo15, x=NewYorkOREnd+3600000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*1.5)
- line.set_xy2(id=NewYorkOR_line_lo15, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*1.5)
- line.set_xy1(id=NewYorkOR_line_lo175, x=NewYorkOREnd+5000000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*1.75)
- line.set_xy2(id=NewYorkOR_line_lo175, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*1.75)
- line.set_xy1(id=NewYorkOR_line_lo20, x=NewYorkOREnd+7200000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2)
- line.set_xy2(id=NewYorkOR_line_lo20, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2)
- line.set_xy1(id=NewYorkOR_line_lo225, x=NewYorkOREnd+8800000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2.25)
- line.set_xy2(id=NewYorkOR_line_lo225, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2.25)
- line.set_xy1(id=NewYorkOR_line_lo25, x=NewYorkOREnd+10800000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2.5)
- line.set_xy2(id=NewYorkOR_line_lo25, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2.5)
- line.set_xy1(id=NewYorkOR_line_lo30, x=NewYorkOREnd+12800000, y=NewYork_lo-(NewYork_hi-NewYork_lo)*3)
- line.set_xy2(id=NewYorkOR_line_lo30, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*3)
- // Plot the IB STDEV Labels
- if showLabels
- label.set_text(id=NewYorkORLabelHigh05, text="0.5 OR")
- label.set_xy(id=NewYorkORLabelHigh05, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)/2)
- label.set_text(id=NewYorkORLabelHigh10, text="1.0 OR")
- label.set_xy(id=NewYorkORLabelHigh10, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo))
- label.set_text(id=NewYorkORLabelHigh20, text="2.0 OR")
- label.set_xy(id=NewYorkORLabelHigh20, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*2)
- label.set_text(id=NewYorkORLabelHigh30, text="3.0 OR")
- label.set_xy(id=NewYorkORLabelHigh30, x=CashSessionEndTime, y=NewYork_hi+(NewYork_hi-NewYork_lo)*3)
- label.set_text(id=NewYorkORLabelLow05, text="-0.5 OR")
- label.set_xy(id=NewYorkORLabelLow05, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)/2)
- label.set_text(id=NewYorkORLabelLow10, text="-1.0 OR")
- label.set_xy(id=NewYorkORLabelLow10, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo))
- label.set_text(id=NewYorkORLabelLow20, text="-2.0 OR")
- label.set_xy(id=NewYorkORLabelLow20, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*2)
- label.set_text(id=NewYorkORLabelLow30, text="-3.0 OR")
- label.set_xy(id=NewYorkORLabelLow30, x=CashSessionEndTime, y=NewYork_lo-(NewYork_hi-NewYork_lo)*3)
- // END NewYork Session Code
- // ***
- // New York Initial Balance Logic
- // Determine the opening Bar - depending of Resolution
- open_bar = switch timeframe.period
- "5" => time_close(timeframe.period, "0825-0830", "America/Chicago")
- "15" => time_close(timeframe.period, "0815-0830", "America/Chicago")
- "30" => time_close(timeframe.period, "0800-0830", "America/Chicago")
- // End Opening bar code
- // ******
- // End of session code
- // -------------------------------------------------------------------------------
- // Previous Day's Open
- if showPDO and timeframe.isintraday // Plot the Previous Day's Open line and label
- _CashSessionEndTime = timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- var PDOpen_line = line.new(x1=_CashSessionEndTime[1], y1=PreviousDayOpen, x2=_CashSessionEndTime, xloc=xloc.bar_time, y2=PreviousDayOpen, color=color.orange) // Create the price line of the Previous Days Open
- var PDOLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small) // Create the label for the Previous Days Open line
- line.set_xy1(id=PDOpen_line, x=_CashSessionEndTime-86400000, y=PreviousDayOpen) // Draw the PDO Line from the Previous Day's open to the end of the current session
- line.set_xy2(id=PDOpen_line, x=_CashSessionEndTime, y=PreviousDayOpen) // Draw the PDO Line from the Previous Day's open to the end of the current session
- if showLabels
- label.set_xy(id=PDOLabel, x=_CashSessionEndTime, y=PreviousDayOpen) // PDO Label placement
- label.set_tooltip(PDOLabel, "Previous Day Open: " + str.tostring(PreviousDayOpen)) // PDO Label tooltip with PD Open value
- // END Previous Day's Open
- // Previous Day's Close
- if showPDC and timeframe.isintraday // Plot the Previous Day's Close line and label
- _CashSessionEndTime = timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- var PDClose_line = line.new(x1=_CashSessionEndTime[1], y1=PreviousDayClose, x2=_CashSessionEndTime, xloc=xloc.bar_time, y2=PreviousDayClose, color=color.orange) // Create the price line of the Previous Days Close
- var PDCLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- line.set_xy1(id=PDClose_line, x=_CashSessionEndTime-86400000, y=PreviousDayClose) // Draw the PDC Line from the Previous Day's close to the end of the current session
- line.set_xy2(id=PDClose_line, x=_CashSessionEndTime, y=PreviousDayClose) // Draw the PDC Line from the Previous Day's close to the end of the current session
- if showLabels
- label.set_xy(id=PDCLabel, x=_CashSessionEndTime, y=PreviousDayClose) // PDC Label placement
- label.set_tooltip(PDCLabel, "Previous Day Close: " + str.tostring(PreviousDayClose)) // PDC Label tooltip with PDC value
- // END Previous Day's Close
- // Previous Week's Open
- if showPWO and timeframe.isintraday // Plot the Previous Week's Open line and label
- _CashSessionEndTime = timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- var PWOpen_line = line.new(x1=_CashSessionEndTime[1], y1=PreviousWeekOpen, x2=_CashSessionEndTime, xloc=xloc.bar_time, y2=PreviousWeekOpen, color=color.orange) // Create the price line of the Previous Week Open
- var PWOLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small) // Create the label for the Previous Week Open line
- line.set_xy1(id=PWOpen_line, x=_CashSessionEndTime-86400000, y=PreviousWeekOpen) // Draw the PWO Line from the Previous Week's open to the end of the current session
- line.set_xy2(id=PWOpen_line, x=_CashSessionEndTime, y=PreviousWeekOpen) // Draw the PWO Line from the Previous Week's open to the end of the current session
- if showLabels
- label.set_xy(id=PWOLabel, x=_CashSessionEndTime, y=PreviousWeekOpen) // PWO Label placement
- label.set_tooltip(PWOLabel, "Previous Week Open: " + str.tostring(PreviousWeekOpen)) // PWO Label tooltip with CW Open value
- // END Current Week's Open
- // Previous Week's Close
- if showPWC and timeframe.isintraday // Plot the Previous Week's Close line and label
- _CashSessionEndTime = timestamp("America/Chicago", year, month, dayofmonth, i_NYSessionEndHour, i_NYSessionEndMin, 00) // Coordinate for NY End of Cash session time (this is the terminus for the Level lines)
- var PWClose_line = line.new(x1=_CashSessionEndTime[1], y1=PreviousWeekClose, x2=_CashSessionEndTime, xloc=xloc.bar_time, y2=PreviousWeekClose, color=color.orange) // Create the price line of the Previous Weeks Close
- var PWCLabel = label.new(x=na, y=na, xloc=xloc.bar_time, color=color.new(color.gray, 90), textcolor=color.white, style=label.style_label_left, size=size.small)
- line.set_xy1(id=PWClose_line, x=_CashSessionEndTime-86400000, y=PreviousWeekClose) // Draw the PWC Line from the Previous Week's close to the end of the current session
- line.set_xy2(id=PWClose_line, x=_CashSessionEndTime, y=PreviousWeekClose) // Draw the PWC Line from the Previous Week's close to the end of the current session
- if showLabels
- label.set_xy(id=PWCLabel, x=_CashSessionEndTime, y=PreviousWeekClose) // PWC Label placement
- label.set_tooltip(PWCLabel, "Previous Week Close: " + str.tostring(PreviousWeekClose)) // PWC Label tooltip with PWC value
- // END Previous Week's Close
- // ALERTS!
- // Check if price crosses key levels and generate alerts
- f_triggerGlobexLow() // Price crosses the Globex Overnight Low level?
- f_triggerGlobexHigh() // Price crosses the Globex Overnight High level?
- f_triggerNewYorkOR50perc() // When the New York Opening Range has ended... check to see if the 50% level is crossed
- f_triggerNewYorkSTDEVpos05() // When the New York Opening Range has ended... check to see if the STDEV 0.5 level is crossed
- f_triggerNewYorkSTDEVpos10() // When the New York Opening Range has ended... check to see if the STDEV 1.0 level is crossed
- f_triggerNewYorkSTDEVneg05() // When the New York Opening Range has ended... check to see if the STDEV -0.5 level is crossed
- f_triggerNewYorkSTDEVneg10() // When the New York Opening Range has ended... check to see if the STDEV -1.0 level is crossed
- // End of Alert section
- // Start Plotting
- bgcolor(showGlobex == true and time == GlobexSession ? color.new(i_GlobexSessionCol,90) : na) // Highlight the Globex (Overnight) Range
- bgcolor(showOpenbar == true and open_bar ? color.new(i_NYSessionCol, 75) : na) // Highlight the Bar before the New York Cash Open
- bgcolor(showAsian == true and time == AsianSession ? color.new(i_AsianSessionCol,90) : na) // Highlight the Asian Range
- bgcolor(showLondon == true and time == LondonSession ? color.new(i_LondonSessionCol,90) : na) // Highlight the London Range
- bgcolor(showNewYork == true and time == NewYorkSession ? color.new(i_NYSessionCol,90) : na) // Highlight the NewYork Range
- // Debug plots
- plot(showDebug ? NewYorkHr1lo : na, title='NewYorkHr1lo', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYorkHr1mid : na, title='NewYorkHr1mid', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYorkHr1hi : na, title='NewYorkHr1hi', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYork_hi : na, title='NewYork_hi', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYork_lo : na, title='NewYork_lo', color=color.new(#00ffaa, 70))
- plot(showDebug ? (NewYorkHr1hi+(NewYorkHr1hi-NewYorkHr1lo)/2) : na, title='NewYorkSTDEVpos05', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYorkHr1hi+(NewYorkHr1hi-NewYorkHr1lo) : na, title='NewYorkSTDEVpos10', color=color.new(#00ffaa, 70))
- plot(showDebug ? (NewYorkHr1lo-(NewYorkHr1hi-NewYorkHr1lo)/2) : na, title='NewYorkSTDEVneg05', color=color.new(#00ffaa, 70))
- plot(showDebug ? NewYorkHr1lo-(NewYorkHr1hi-NewYorkHr1lo) : na, title='NewYorkSTDEVneg10', color=color.new(#00ffaa, 70))
Advertisement
Add Comment
Please, Sign In to add comment