//** //* depth -> length -> zero //* lengthが最高値・最安値であるかを確認 //* trueならbar_indexと価格を返す //* pivots(src, length, isHigh) => p = nz(src[length]) if length == 0 [bar_index, p] else isFound = true for i = 0 to length - 1 if isHigh and src[i] > p isFound := false if not isHigh and src[i] < p isFound := false for i = length + 1 to 2 * length if isHigh and src[i] >= p isFound := false if not isHigh and src[i] <= p isFound := false if isFound and length * 2 <= bar_index [bar_index[length], p] else [int(na), float(na)]
// 直近のpivotの情報を格納 var line lineLast = na // lineのid (実際はidではなく識別している何か) var float pLast = 0 // price var bool isHighLast = true // High か Low か var int linesCount = 0
// ジグザグが発生したときのジグザグの値を取得 x = valuewhen(zigzag, zigzag, 4) a = valuewhen(zigzag, zigzag, 3) b = valuewhen(zigzag, zigzag, 2) //3つ前 c = valuewhen(zigzag, zigzag, 1) //前々回 d = valuewhen(zigzag, zigzag, 0) //前回
fib_range = abs(d-c) fib_0000 = not showFib0000 ? na : d > c ? d-(fib_range*0.000):d+(fib_range*0.000) fib_0236 = not showFib0236 ? na : d > c ? d-(fib_range*0.236):d+(fib_range*0.236) fib_0382 = not showFib0382 ? na : d > c ? d-(fib_range*0.382):d+(fib_range*0.382) fib_0500 = not showFib0500 ? na : d > c ? d-(fib_range*0.500):d+(fib_range*0.500) fib_0618 = not showFib0618 ? na : d > c ? d-(fib_range*0.618):d+(fib_range*0.618) fib_0764 = not showFib0764 ? na : d > c ? d-(fib_range*0.764):d+(fib_range*0.764) fib_1000 = not showFib1000 ? na : d > c ? d-(fib_range*1.000):d+(fib_range*1.000) plot(title='Fib 0.000' ,series=fib_0000 ,offset=-1*floor(depth/2) ,color=fib_0000 != fib_0000[1] ? na : color.black) plot(title='Fib 0.236' ,series=fib_0236 ,offset=-1*floor(depth/2) ,color=fib_0236 != fib_0236[1] ? na : color.red) plot(title='Fib 0.382' ,series=fib_0382 ,offset=-1*floor(depth/2) ,color=fib_0382 != fib_0382[1] ? na : color.olive) plot(title='Fib 0.500' ,series=fib_0500 ,offset=-1*floor(depth/2) ,color=fib_0500 != fib_0500[1] ? na : color.lime) plot(title='Fib 0.618' ,series=fib_0618 ,offset=-1*floor(depth/2) ,color=fib_0618 != fib_0618[1] ? na : color.teal) plot(title='Fib 0.764' ,series=fib_0764 ,offset=-1*floor(depth/2) ,color=fib_0764 != fib_0764[1] ? na : color.blue) plot(title='Fib 1.000' ,series=fib_1000 ,offset=-1*floor(depth/2) ,color=fib_1000 != fib_1000[1] ? na : color.black) =====
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.