pinescript-在特定时间范围内以最低的价格绘制Hline
我能够在主图表中的特定时间(ex.10:00)创建一个hline的hline。如果我想以1分钟图中的时间范围的最低价格(例如10:00-10:05)创建Hline,该怎么办?
//@version=5
indicator("My Script", overlay=true)
_h = 10 // Hour: 10
_m = 0 // Minute: 0
inWindow = (hour(time) == _h) and (minute(time) == _m)
var line l = na
if (inWindow)
l := line.new(bar_index, low, bar_index + 1, low, extend=extend.right, color=color.orange, width=2)
line.delete(l[1])
I was able to create a Hline on price low at a specific time (ex.10:00) in the main chart. How should I go about if I wanted to create a Hline at the lowest price of a time range (say 10:00 - 10:05) in a 1min chart?
//@version=5
indicator("My Script", overlay=true)
_h = 10 // Hour: 10
_m = 0 // Minute: 0
inWindow = (hour(time) == _h) and (minute(time) == _m)
var line l = na
if (inWindow)
l := line.new(bar_index, low, bar_index + 1, low, extend=extend.right, color=color.orange, width=2)
line.delete(l[1])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
input.session()
获取时间范围,并使用time()
查看您是否处于选定的时间窗口内。You can use the
input.session()
to get the time frame andtime()
to see if you are in the selected time window.