0

寻找一种简单的方法来将累积音量范围指示器的输入设置为指定数量的 CANDLES,而不是选择一个 RESOLUTION 来回顾。


is_new_day = change(time(cTimeFrame)) != 0 ? 1 : 0
cnt_new_day = barssince(is_new_day)

// Accumulation
cvol = 0.0
for i = 0 to cnt_new_day
    cvol := cvol + volume[i]

plot(cvol, "Cumulative Volume", style=plot.style_columns, color= color.yellow)
4

1 回答 1

0

您需要在一个变量中累积交易量并每 N 个柱重置一次

//@version=5
indicator("My Script")
length = input.int(1, "Length", minval=1)

cvol = volume
cvol += bar_index % length == 0 ? 0 : cvol[1]

plot(cvol, "Cumulative Volume", style=plot.style_columns, color= color.yellow)
于 2022-01-14T16:58:59.337 回答