在指定的一定天数后绘制垂直线

发布于 2025-01-13 18:32:18 字数 682 浏览 0 评论 0原文

我希望能够在特定天数和柱形过去后在日线图上绘制一条垂直线。下面的代码仅绘制第一条垂直线:(

//@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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我要还你自由 2025-01-20 18:32:18

在此示例中,我们通过从柱的开盘时间中减去收盘时间来计算出一根柱中的时间。然后我们可以将其与您向前的柱数一起用作乘数。我们还需要对照新的绘图时间检查时间,而不是对照彼此的绘图时间,这永远不会使

//@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)

var barTime = time_close - time
plotTime2 = plotTime + (5 * barTime)
plot((time == plotTime2) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)

plotTime3 = plotTime + (9 * barTime) 
plot((time == plotTime3) ? 10e20 : na, color = color.red, linewidth = 10, title = "MyLine", style = plot.style_histogram)

干杯和祝您好运与您的编码和交易保持一致

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

//@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)

var barTime = time_close - time
plotTime2 = plotTime + (5 * barTime)
plot((time == plotTime2) ? 10e20 : na, color = color.red, linewidth = 1, title = "MyLine", style = plot.style_histogram)

plotTime3 = plotTime + (9 * barTime) 
plot((time == plotTime3) ? 10e20 : na, color = color.red, linewidth = 10, title = "MyLine", style = plot.style_histogram)

Cheers and best of luck with your coding and trading

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文