#Thinkorswim studies #FIBO по прошлой неделе #Показывает на графике уровни Фибоначчи по предыдущему недельному бару #Thinkorswim https://RadchenkoVY.com/TOS input price = close; input showOnlyToday = yes; input ShowLabels = no; input period = AggregationPeriod.WEEK; # если нужно чтобы показывало Фибоначчи по бару не предыдущей недели, а вчерашнего дня, то измените здесь просто на AggregationPeriod.DAY; input displace = 1; def prevHigh = if (showOnlyToday and !IsNaN(close(period = period)[-1])) or isnan(close[1]) then double.nan else high(period = period)[displace]; def prevLow = if (showOnlyToday and !IsNaN(close(period = period)[-1])) or isnan(close[1]) then double.nan else low(period = period)[displace]; def shouldplot = yes; plot pivot = if shouldPlot then (prevHigh) else Double.NaN; pivot.SetStyle(Curve.FIRM); pivot.SetDefaultColor(Color.yelLOW); plot h7 = if shouldPlot then pivot + 2 * (prevHigh - prevLow) else Double.NaN; h7.SetStyle(Curve.FIRM); h7.SetDefaultColor(Color.Green); plot h8 = if shouldPlot then pivot + 1.764 * (prevHigh - prevLow) else Double.NaN; h8.SetStyle(Curve.FIRM); h8.SetDefaultColor(Color.gRAY); plot h9 = if shouldPlot then pivot + 1.618 * (prevHigh - prevLow) else Double.NaN; h9.SetStyle(Curve.FIRM); h9.SetDefaultColor(Color.gRAY); plot h10 = if shouldPlot then pivot + 1.5 * (prevHigh - prevLow) else Double.NaN; h10.SetStyle(Curve.FIRM); h10.SetDefaultColor(Color.gRAY); plot h11 = if shouldPlot then pivot + 1.382 * (prevHigh - prevLow) else Double.NaN; h11.SetStyle(Curve.FIRM); h11.SetDefaultColor(Color.gRAY); plot h12 = if shouldPlot then pivot + 1.214 * (prevHigh - prevLow) else Double.NaN; h12.SetStyle(Curve.FIRM); h12.SetDefaultColor(Color.gRAY); plot h1 = if shouldPlot then pivot + 1 * (prevHigh - prevLow) else Double.NaN; h1.SetStyle(Curve.FIRM); h1.SetDefaultColor(Color.GREEN); plot h2 = if shouldPlot then pivot + 0.764 * (prevHigh - prevLow) else Double.NaN; h2.SetStyle(Curve.FIRM); h2.SetDefaultColor(Color.gRAY); plot h3 = if shouldPlot then pivot + 0.618 * (prevHigh - prevLow) else Double.NaN; h3.SetStyle(Curve.FIRM); h3.SetDefaultColor(Color.gRAY); plot h4 = if shouldPlot then pivot + 0.5 * (prevHigh - prevLow) else Double.NaN; h4.SetStyle(Curve.FIRM); h4.SetDefaultColor(Color.gRAY); plot h5 = if shouldPlot then pivot + 0.382 * (prevHigh - prevLow) else Double.NaN; h5.SetStyle(Curve.FIRM); h5.SetDefaultColor(Color.gRAY); plot h6 = if shouldPlot then pivot + 0.214 * (prevHigh - prevLow) else Double.NaN; h6.SetStyle(Curve.FIRM); h6.SetDefaultColor(Color.gRAY); plot l1 = if shouldPlot then pivot - 1 * (prevHigh - prevLow) else Double.NaN; l1.SetStyle(Curve.FIRM); l1.SetDefaultColor(Color.yelLOW); plot l2 = if shouldPlot then pivot - 0.764 * (prevHigh - prevLow) else Double.NaN; l2.SetStyle(Curve.FIRM); l2.SetDefaultColor(Color.gRAY); plot l3 = if shouldPlot then pivot - 0.618 * (prevHigh - prevLow) else Double.NaN; l3.SetStyle(Curve.FIRM); l3.SetDefaultColor(Color.gRAY); plot l4 = if shouldPlot then pivot - 0.5 * (prevHigh - prevLow) else Double.NaN; l4.SetStyle(Curve.FIRM); l4.SetDefaultColor(Color.gRAY); plot l5 = if shouldPlot then pivot - 0.382 * (prevHigh - prevLow) else Double.NaN; l5.SetStyle(Curve.FIRM); l5.SetDefaultColor(Color.gRAY); plot l6 = if shouldPlot then pivot - 0.214 * (prevHigh - prevLow) else Double.NaN; l6.SetStyle(Curve.FIRM); l6.SetDefaultColor(Color.gRAY); plot l7 = if shouldPlot then pivot - 2 * (prevHigh - prevLow) else Double.NaN; l7.SetStyle(Curve.FIRM); l7.SetDefaultColor(Color.RED); plot l8 = if shouldPlot then pivot - 1.764 * (prevHigh - prevLow) else Double.NaN; l8.SetStyle(Curve.FIRM); l8.SetDefaultColor(Color.gRAY); plot l9 = if shouldPlot then pivot - 1.618 * (prevHigh - prevLow) else Double.NaN; l9.SetStyle(Curve.FIRM); l9.SetDefaultColor(Color.gRAY); plot l10 = if shouldPlot then pivot - 1.5 * (prevHigh - prevLow) else Double.NaN; l10.SetStyle(Curve.FIRM); l10.SetDefaultColor(Color.gRAY); plot l11 = if shouldPlot then pivot - 1.382 * (prevHigh - prevLow) else Double.NaN; l11.SetStyle(Curve.FIRM); l11.SetDefaultColor(Color.gRAY); plot l12 = if shouldPlot then pivot - 1.214 * (prevHigh - prevLow) else Double.NaN; l12.SetStyle(Curve.FIRM); l12.SetDefaultColor(Color.gRAY);