如何在 Renko 蜡烛图上绘制时间结束时的形状

问题描述 投票:0回答:1

我想在 Renko Candle 结束时绘制形状,收盘时间为 30 分钟。但它只在时间间隔开始时绘制。

//@version=5
indicator(title='Renko Brick Close', overlay=true)

res = input('30')
isnew = ta.change(time(res)) != 0

plotshape(isnew)

如何在那个时期结束而不是开始时绘制形状。没有

request.security
offset
是否可以做到这一点?

pine-script pine-script-v5 algorithmic-trading pine-script-v4
1个回答
0
投票

使用 barstate.isconfirmed 它只会在蜡烛关闭后绘制形状

例如,这会在除实时蜡烛之外的每根蜡烛上绘制一个向上或向下的箭头

closeup = close > open
closedown = close < open

plotshape(closeup and barstate.isconfirmed, 'close up', shape.arrowup, location = location.belowbar)
plotshape(closedown and barstate.isconfirmed, 'close down', shape.arrowdown, location = location.abovebar)
© www.soinside.com 2019 - 2024. All rights reserved.