我不想在三角形上显示每个枢轴高/低/低,如果我选中它的框,它只是最近的最新高和最近的低点
showrecentonly = input(title =“枢轴highs& lows”,defval = false)
lb = input(defval=5, title='Left Bars')
rb = input(defval=5, title='Right Bars')
mb = lb + rb + 1
highestbars_1 = ta.highestbars(mb)
iff_1 = highestbars_1 == -lb ? high[lb] : na
plotshape(not na(high[mb]) ? iff_1 : na, title='Triangle Pivot High', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 60), size=size.tiny, offset=-lb)
lowestbars_1 = ta.lowestbars(mb)
iff_2 = lowestbars_1 == -lb ? low[lb] : na
plotshape(not na(low[mb]) ? iff_2 : na, title='Triangle Pivot Low', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 60), size=size.tiny, offset=-lb)
showRecentOnly = input(title="Pivots Highs & Lows", defval=false)
lb = input(defval=5, title='Left Bars')
rb = input(defval=5, title='Right Bars')
mb = lb + rb + 1
highestbars_1 = ta.highestbars(mb)
iff_1 = highestbars_1 == -lb ? high[lb] : na
plotshape(not na(high[mb]) ? iff_1 : na, title='Triangle Pivot High', style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 60), size=size.tiny, offset=-lb)
lowestbars_1 = ta.lowestbars(mb)
iff_2 = lowestbars_1 == -lb ? low[lb] : na
plotshape(not na(low[mb]) ? iff_2 : na, title='Triangle Pivot Low', style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 60), size=size.tiny, offset=-lb)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我们要仅以最后的高和低点绘制三角形,那么当新的高/低点发生新的高/低时,我们也必须删除它们,并且不可能使用Pinescript删除形状。我们只能删除行和框等。因此,在这里我完成了一个版本,您可以单击一个复选框以显示最新枢轴高低的线,然后取消选中以查看以前的状态
If we are going to plot the triangles for only last high and low, then we will have to delete them too when new high/low occurs and it is not possible to delete shapes using pinescript. We can only delete lines and boxes etc. So here I have done a version where you can click a checkbox to show line for latest pivot high lows and uncheck to see how it was previously
Before checking After checking