在Pinescript中绘制特定日期的水平线



我是pinescript&编程。我想每天在5分钟的图表上画出特定水平的水平线。这些级别每天都在变化,将由我手动定义。

有人能帮我密码吗?在网上阅读时,我可以理解plot((和绘制基本线条等基本函数,但无法创建线条每天变化的逻辑。

例如:3月1日,将要绘制的级别可以是16700&16800;3月2日,将绘制的级别可以是16900&17000等等&等等。

提前感谢,Karthik!

您可以使用ImmortalFreedom创建的vline()函数。

//@version=4
study("vline() Function for Pine Script v4.0+", overlay=true)
vline(BarIndex, Color, LineStyle, LineWidth) => // Verticle Line Function, ≈50-54 lines maximum allowable per indicator
// return = line.new(BarIndex,   0.0, BarIndex,     100.0, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) // Suitable for study(overlay=false) and RSI, Stochastic, etc...
// return = line.new(BarIndex,  -1.0, BarIndex,       1.0, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) // Suitable for study(overlay=false) and +/-1.0 oscillators
return = line.new(BarIndex, low - tr, BarIndex, high + tr, xloc.bar_index, extend.both, Color, LineStyle, LineWidth) // Suitable for study(overlay=true)
if(bar_index%10==0.0) // Generically plots a line every 10 bars
vline(bar_index, #FF8000ff, line.style_solid, 1) // Variable assignment not required

或者你可以使用style = plot.style_columns技巧。

//@version=4
study("", "", true, scale = scale.none)
cond = close > open
plot(cond ? 10e20 : na, style = plot.style_columns, color = color.silver, transp=85)

最新更新