Pine Script (TradingView) 获取下一个会话的详细信息
Pine Script (TradingView) get next session details
使用 Pine Script 我可以用下面的代码绘制一条自定义线。
l = line.new(timestamp(2020, 04, 07, 09, 15), 17500, timestamp(2020, 04, 08, 09, 15), 17500, xloc.bar_time)
line.delete(l[1])
我想为 下一个交易日 画一条自定义线(如下图所示)。
有没有办法在 Pine Script 中找到即将到来的交易日的时间戳??
这将适用于 24/7 市场。当您可以在真实市场上进行测试时,您可能需要进行调整:
//@version=4
study("", "", true)
y = high
x1 = timestamp(year(timenow), month(timenow), dayofmonth(timenow) + 1, 9, 30)
x2 = timestamp(year(timenow), month(timenow), dayofmonth(timenow) + 2, 9, 30)
var line l = na
if barstate.islast
if na(l)
// Only create line once, then update it.
l := line.new(x1, y, x2, y, xloc.bar_time)
// Make 2 if blocks same type so compiler doesn't complain.
int(na)
else
line.set_xy1(l, x1, y)
line.set_xy2(l, x2, y)
int(na)
使用 Pine Script 我可以用下面的代码绘制一条自定义线。
l = line.new(timestamp(2020, 04, 07, 09, 15), 17500, timestamp(2020, 04, 08, 09, 15), 17500, xloc.bar_time)
line.delete(l[1])
我想为 下一个交易日 画一条自定义线(如下图所示)。
有没有办法在 Pine Script 中找到即将到来的交易日的时间戳??
这将适用于 24/7 市场。当您可以在真实市场上进行测试时,您可能需要进行调整:
//@version=4
study("", "", true)
y = high
x1 = timestamp(year(timenow), month(timenow), dayofmonth(timenow) + 1, 9, 30)
x2 = timestamp(year(timenow), month(timenow), dayofmonth(timenow) + 2, 9, 30)
var line l = na
if barstate.islast
if na(l)
// Only create line once, then update it.
l := line.new(x1, y, x2, y, xloc.bar_time)
// Make 2 if blocks same type so compiler doesn't complain.
int(na)
else
line.set_xy1(l, x1, y)
line.set_xy2(l, x2, y)
int(na)