在 Pine 脚本中绘制其他时间范围
Drawing on other time frame in Pine script
我需要在每日蜡烛图的顶部画一些线,并将它们保持在较低的时间范围内。在我看来,安全功能并没有派上用场,因为它的主要职责是策划或将输出提供给其他功能。有人知道怎么做吗?
下面根据您的要求显示每日最高点。
//@version=4
study("Daily - Highs", overlay = true)
ShowDailyHighs = input(true, title = "Show Daily High", group = "Show / Hide Highs", type = input.bool)
dtf = "D", title = "Time Frame", type = input.resolution
is_new_bar(t) =>
change(time(t)) != 0
float DdHigh = 0.0
float DHigh = 0.0
DHigh := security(syminfo.tickerid, 'D', high)
DdHigh := is_new_bar(dtf) ? DHigh[0] : DdHigh[0]
if ShowDailyHighs and is_new_bar(dtf)
line.new(time, DdHigh, time+1, DdHigh, xloc=xloc.bar_time, color=color.blue, extend=extend.right)
我需要在每日蜡烛图的顶部画一些线,并将它们保持在较低的时间范围内。在我看来,安全功能并没有派上用场,因为它的主要职责是策划或将输出提供给其他功能。有人知道怎么做吗?
下面根据您的要求显示每日最高点。
//@version=4
study("Daily - Highs", overlay = true)
ShowDailyHighs = input(true, title = "Show Daily High", group = "Show / Hide Highs", type = input.bool)
dtf = "D", title = "Time Frame", type = input.resolution
is_new_bar(t) =>
change(time(t)) != 0
float DdHigh = 0.0
float DHigh = 0.0
DHigh := security(syminfo.tickerid, 'D', high)
DdHigh := is_new_bar(dtf) ? DHigh[0] : DdHigh[0]
if ShowDailyHighs and is_new_bar(dtf)
line.new(time, DdHigh, time+1, DdHigh, xloc=xloc.bar_time, color=color.blue, extend=extend.right)