//@version=4
study(title="Neely Charts", overlay=true)
//Define variables
string res = input("D")
var float h_price = na
var float l_price = na
var int h_date = na
var int l_date = na
var float h1_price = na
var float l1_price = na
var int h1_date = na
var int l1_date = na
var line z = na
var line w = na
bool isnewtbar = change(time(res)) > 0
//getting lines
if isnewtbar and bar_index > 1
h_price := high
l_price := low
h_date := time
l_date := time
z := line.new(x1=h_date, y1=h_price, x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2)
w := line.new(x1=line.get_x2(z[1]), y1=line.get_y2(z[1]), x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2)
if high > h_price
h_price := high
h_date := time
if low < l_price
l_price := low
l_date := time
if h_date <= l_date
// high to low
line.set_xy1(id=z, x=h_date, y=h_price)
line.set_xy2(id=z, x=l_date, y=l_price)
line.set_color(id=z, color=color.red)
else
// low to high
line.set_xy1(id=z, x=l_date, y=l_price)
line.set_xy2(id=z, x=h_date, y=h_price)
line.set_color(id=z, color=color.lime)
line.set_xy2(id=w, x=line.get_x1(z[0]), y=line.get_y1(z[0]))
line.set_color(id=w, color=color.blue)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…