In this code, if Volume > 10 mil, I start to add the volume to Cumulative volume and we create a line below the candle which extend until current bar, so volume > 10 mil , we create a line and cumvol += volume.
在这段代码中,如果Volume>10mil,我开始将体积添加到Cumulative Volume,我们在蜡烛下面创建一条线,一直延伸到当前条,因此Volume>10mil,我们创建一条线,Cumvol+=Volume。
However, I want to subtract volume associated with the line if the price broke the line ( Low < y value of line).
然而,我想减去与这条线相关的成交量,如果价格突破了这条线(线的低
I tried to track the line and its volume but it never subtract any volume from it.
我试着跟踪这条线和它的音量,但它从来没有减去任何音量。
here is part of the code:
以下是代码的一部分:
float yValue = na
int x1 = na
int x2 = na
L100x = close * (1 - 0.005)
var float cumLvol = 0.0
var arr = array.new_line(50)
var arrVolume = array.new_float(50)
var float lineVolume = 0.0
// condition to start adding to cumulative
if volume > 10000000
x1 := bar_index
x2 := bar_index
yValue := L100x
array.push(arrVolume, Lvol)
cumLvol += volume
// if line brokes we reduce the volume
for i = array.size(arr) - 1 to 0 by 1
yValue := line.get_y1(array.get(arr, i))
lineVolume := array.get(arrVolume, i)
if low < yValue
cumLvol -= lineVolume
// Plot the cumulative Lvol
plot(series=cumLvol, title="Cumulative Lvol", color=color.blue)
not sure what's wrong with it.
不知道它出了什么问题。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!