我构建了一个 pine 脚本,它在 09:30 - 16:00 的 15 分钟图表中为我提供每分钟的音量。我想将数据与同一时间的前一天 15 分钟蜡烛进行比较,以获得每分钟的相对交易量。我怎么做?
//@version=5
indicator('Number bars in session', precision=2, format=format.volume)
timeAllowed = input("0930-1600", session.extended)
// Check to see if we are in allowed hours using session info on all 7 days of the week.
timeIsAllowed = time(timeframe.period, timeAllowed + ":23456")
numBars = 0
t = time('D')
if timeIsAllowed
if t == t[1]
numBars := nz(numBars[1]) + 1
numBars
else
numBars := 1
numBars
total_volume = 0.0
for i = 0 to numBars by 1
total_volume += volume[i]
total_volume
Avol = (total_volume / numBars)/15
plot(Avol)
plot(numBars)