N = input.int(200, title = 'Период оценки')
n = input.int(5, title = 'Баров для фрактала')
ph = ta.pivothigh(high, n, n)
phf = fixnan(ph)
pl = ta.pivotlow(low, n, n)
plf = fixnan(pl)
max = ta.highest(phf, N)
min = ta.lowest(plf, N)
fibo(x) =>
s = min + (max - min)*(x/1000)
s
plot(fibo(232), color = color.red)
plot(fibo(382), color = color.orange)
plot(fibo(500), color = color.yellow)
plot(fibo(618), color = color.green)
plot(fibo(786), color = color.blue)
plot(max, color = color.white)
plot(min, color = color.white)