สร้างเส้นและเติมสีลงในช่องว่างระหว่าง 2 เส้น [Pine Script]


ตอนนี้ที่เจอ มี 2 วิธี คือ Plot & Fill กับ Line & FillLine

Plot & Fill

// Variable
price1 = 2350
price2 = 2360

// Plot line
zs1s = plot(price1, title='Price - Start', color = color.red, linewidth = 1)
zs1e = plot(price2, title='Price - End', color = color.red, linewidth = 1)

// Fill Background
fill(zs1s, zs1e, title='Price', color=color.new(color.red, 90)) 

Line & Linefill

// Variable
price1 = 2350
price2 = 2360
dt = time - time[1]
lineX1 = time - 2 * dt
lineX2 = time + 5 * dt

// Create Line
zs1sl = line.new(lineX1, price1, lineX2, price1, xloc = xloc.bar_time, extend = extend.both, color = color.red)
zs1el = line.new(lineX1, price2, lineX2, price2, xloc = xloc.bar_time, extend = extend.both, color = color.red)

// Fill Background
linefill.new(zs1sl, zs1el, color=color.new(color.red, 98)) 
0 0 votes
Article Rating
0
Would love your thoughts, please comment.x
()
x