//** //* depth -> length -> zero //* lengthが最高値・最安値であるかを確認 //* trueならbar_indexと価格を返す //* pivots(src, length, isHigh) => p = nz(src[length])
if length == 0 [bar_index, p] else isFound = true // length -> zeroの最高値・最安値を確認 for i = 0 to length - 1 if isHigh and src[i] > p isFound := false if not isHigh and src[i] < p isFound := false // depth -> lengthの最高値・最安値を確認 for i = length + 1 to 2 * length if isHigh and src[i] >= p isFound := false if not isHigh and src[i] <= p isFound := false
// lengthが最高値・最安値だった場合は値を返す if isFound and length * 2 <= bar_index [bar_index[length], p] // そうでない場合はnaを返す else [int(na), float(na)]