OPEN-SOURCE SCRIPT
NY Session Open/Close

//version=5
indicator("New York Session Open/Close (Thin Lines)", overlay=true)
// Define the New York session open and close times (adjust for DST if necessary)
ny_open_time = timestamp("GMT-4", year, month, dayofmonth, 9, 30) // New York open at 9:30 AM EST
ny_close_time = timestamp("GMT-4", year, month, dayofmonth, 16, 0) // New York close at 4:00 PM EST
// Variables to store the open and close prices
var float ny_open_price = na
var float ny_close_price = na
// Plot thin vertical line for New York session open
if (time == ny_open_time)
ny_open_price := close
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.new(color.green, 0), width=1, extend=extend.both)
label.new(x=bar_index, y=ny_open_price, text="NY Open: " + str.tostring(ny_open_price), color=color.green, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)
// Plot thin vertical line for New York session close
if (time == ny_close_time)
ny_close_price := close
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.new(color.red, 0), width=1, extend=extend.both)
label.new(x=bar_index, y=ny_close_price, text="NY Close: " + str.tostring(ny_close_price), color=color.red, textcolor=color.white, style=label.style_label_up, yloc=yloc.price)
indicator("New York Session Open/Close (Thin Lines)", overlay=true)
// Define the New York session open and close times (adjust for DST if necessary)
ny_open_time = timestamp("GMT-4", year, month, dayofmonth, 9, 30) // New York open at 9:30 AM EST
ny_close_time = timestamp("GMT-4", year, month, dayofmonth, 16, 0) // New York close at 4:00 PM EST
// Variables to store the open and close prices
var float ny_open_price = na
var float ny_close_price = na
// Plot thin vertical line for New York session open
if (time == ny_open_time)
ny_open_price := close
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.new(color.green, 0), width=1, extend=extend.both)
label.new(x=bar_index, y=ny_open_price, text="NY Open: " + str.tostring(ny_open_price), color=color.green, textcolor=color.white, style=label.style_label_down, yloc=yloc.price)
// Plot thin vertical line for New York session close
if (time == ny_close_time)
ny_close_price := close
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.new(color.red, 0), width=1, extend=extend.both)
label.new(x=bar_index, y=ny_close_price, text="NY Close: " + str.tostring(ny_close_price), color=color.red, textcolor=color.white, style=label.style_label_up, yloc=yloc.price)
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。