【发布时间】:2021-05-16 15:48:58
【问题描述】:
我是 Pine 脚本的初学者,正在尝试新事物。以下是一个 sn-p,它将每日枢轴作为阶梯线添加到图表中。但是,我想在每个值上添加标签而不是行。恳请您帮助实现这一目标。
sd = input(true, title="Show Daily Pivots?")
//Pivot Range Calculations - Mark Fisher
pivot = (high + low + close ) / 3.0
bc = (high + low ) / 2.0
tc = (pivot - bc) + pivot
r1 = (pivot * 2) - low
s1 = (pivot * 2) - high
r2 = pivot + (high - low)
s2 = pivot - (high - low)
r3 = r1 + (high - low)
s3 = s1 - (high - low)
r4 = r3 + (r2 - r1)
s4 = s3 - (s1 - s2)
//Daily Pivot Range
dtime_r1 = security(syminfo.tickerid, 'D', r1[1])
dtime_r2 = security(syminfo.tickerid, 'D', r2[1])
dtime_r3 = security(syminfo.tickerid, 'D', r3[1])
dtime_r4 = security(syminfo.tickerid, 'D', r4[1])
dtime_s1 = security(syminfo.tickerid, 'D', s1[1])
dtime_s2 = security(syminfo.tickerid, 'D', s2[1])
dtime_s3 = security(syminfo.tickerid, 'D', s3[1])
dtime_s4 = security(syminfo.tickerid, 'D', s4[1])
offs_daily = 0
plot(sd and dtime_r1 ? dtime_r1 : na, title="Daily r1",style=plot.style_stepline, color=color.green,linewidth=1)
plot(sd and dtime_r2 ? dtime_r2 : na, title="Daily r2",style=plot.style_stepline, color=color.green,linewidth=1)
plot(sd and dtime_r3 ? dtime_r3 : na, title="Daily r3",style=plot.style_stepline, color=color.green,linewidth=1)
plot(sd and dtime_r4 ? dtime_r4 : na, title="Daily r4",style=plot.style_stepline, color=color.green,linewidth=1)
plot(sd and dtime_s1 ? dtime_s1 : na, title="Daily s1",style=plot.style_stepline, color=color.red,linewidth=1)
plot(sd and dtime_s2 ? dtime_s2 : na, title="Daily s2",style=plot.style_stepline, color=color.red,linewidth=1)
plot(sd and dtime_s3 ? dtime_s3 : na, title="Daily s3",style=plot.style_stepline, color=color.red,linewidth=1)
plot(sd and dtime_s4 ? dtime_s4 : na, title="Daily s4",style=plot.style_stepline, color=color.red,linewidth=1)
【问题讨论】:
标签: pine-script