如何将williams枢轴高位和低位存储到数组中?示例:当形成一个新的枢轴低值时,它将该低值放入数组
这是我的
//Float arrays
var float[] _lowLiqValues = array.new_float()
var float[] _highLiqValues = array.new_float()
//Williams Fractal Period
n = input.int(defval =3, title ="Fractal Period")
//Defining Pivots with n period
pivotHigh = ta.pivothigh(high, n, n)
pivotLow = ta.pivotlow(low,n,n)
//If pivot, put low value or high value to float array
if pivotHigh
highPVT = high[n]
array.push(_highLiqValues, highPVT)
if pivotLow
lowPVT = low[n]
array.push(_lowLiqValues, lowPVT)
ta.pivothigh()
和ta.pivotlow()
返回枢轴价格。所以,你可以直接push它们的返回值。
if (not na(pivotHigh))
array.push(_highLiqValues, pivotHigh)
if (not na(pivotLow))
array.push(_lowLiqValues, pivotLow)