在指定的一定天数后绘制垂直线
我希望能够在特定天数和柱形过去后在日线图上绘制一条垂直线。下面的代码仅绘制第一条垂直线:(
//@version=5
indicator("V", overlay=true, scale=scale.none)
tempTime = timestamp(2022,01,31,02,20)
plotTime = input.time(defval=timestamp("31 Jan 2022 00:00 +0000"), title="Time")
plot((time == plotTime) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)
plotTime2 = plotTime + 5
plot((plotTime == plotTime2) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)
plotTime3 = plotTime + 9
plot((plotTime2 == plotTime3) ? 10e20 : na, color = color.red, linewidth = 10, title = "MyLine", style = plot.style_histogram)
I want to be able to plot a vertical line on a daily chart after a certain days and bars have passed. The code below plots only the first vertical line :(
//@version=5
indicator("V", overlay=true, scale=scale.none)
tempTime = timestamp(2022,01,31,02,20)
plotTime = input.time(defval=timestamp("31 Jan 2022 00:00 +0000"), title="Time")
plot((time == plotTime) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)
plotTime2 = plotTime + 5
plot((plotTime == plotTime2) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)
plotTime3 = plotTime + 9
plot((plotTime2 == plotTime3) ? 10e20 : na, color = color.red, linewidth = 10, title = "MyLine", style = plot.style_histogram)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在此示例中,我们通过从柱的开盘时间中减去收盘时间来计算出一根柱中的时间。然后我们可以将其与您向前的柱数一起用作乘数。我们还需要对照新的绘图时间检查时间,而不是对照彼此的绘图时间,这永远不会使
干杯和祝您好运与您的编码和交易保持一致
In this example we figure out how much time is in one bar by subtracting the close time from the open time of a bar. We can then use that with your number of bars forward as a multiplier. We also need to check time against the new plot times rather than the plot times against one another, which will never align
Cheers and best of luck with your coding and trading