#The following is my version of a multi symbol squeeze pro. It calculates a squeeze across the 4 major indexes, several of the sector ETFs and the VIX
declare lower;
def over_bought0 = -10;
plot OverBought0 = over_bought0;
OverBought0.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought0.SetStyle(Curve.LONG_DASH);
OverBought0.SetLineWeight(3);
def over_bought = 0;
plot OverBought = over_bought;
OverBought.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought.SetStyle(Curve.LONG_DASH);
OverBought.SetLineWeight(3);
def over_bought1 = 10;
plot OverBought1 = over_bought1;
OverBought1.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought1.SetStyle(Curve.LONG_DASH);
OverBought1.SetLineWeight(3);
def over_bought2 = 20;
plot OverBought2 = over_bought2;
OverBought2.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought2.SetStyle(Curve.LONG_DASH);
OverBought2.SetLineWeight(3);
def over_bought3 = 30;
plot OverBought3 = over_bought3;
OverBought3.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought3.SetStyle(Curve.LONG_DASH);
OverBought3.SetLineWeight(3);
def over_bought4 = 40;
plot OverBought4 = over_bought4;
OverBought4.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought4.SetStyle(Curve.LONG_DASH);
OverBought4.SetLineWeight(3);
def over_bought5 = 50;
plot OverBought5 = over_bought5;
OverBought5.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought5.SetStyle(Curve.LONG_DASH);
OverBought5.SetLineWeight(3);
def over_bought6 = 60;
plot OverBought6 = over_bought6;
OverBought6.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought6.SetStyle(Curve.LONG_DASH);
OverBought6.SetLineWeight(3);
def over_bought7 = 70;
plot OverBought7 = over_bought7;
OverBought7.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought7.SetStyle(Curve.LONG_DASH);
OverBought7.SetLineWeight(3);
def over_bought8 = 80;
plot OverBought8 = over_bought8;
OverBought8.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought8.SetStyle(Curve.LONG_DASH);
OverBought8.SetLineWeight(3);
def over_bought9 = 90;
plot OverBought9 = over_bought9;
OverBought9.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought9.SetStyle(Curve.LONG_DASH);
OverBought9.SetLineWeight(3);
def over_bought10 = 100;
plot OverBought10 = over_bought10;
OverBought10.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought10.SetStyle(Curve.LONG_DASH);
OverBought10.SetLineWeight(3);
def over_bought11 = 110;
plot OverBought11 = over_bought11;
OverBought11.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought11.SetStyle(Curve.LONG_DASH);
OverBought11.SetLineWeight(3);
def over_bought12 = 120;
plot OverBought12 = over_bought12;
OverBought12.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought12.SetStyle(Curve.LONG_DASH);
OverBought12.SetLineWeight(3);
def over_bought13 = 130;
plot OverBought13 = over_bought13;
OverBought13.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought13.SetStyle(Curve.LONG_DASH);
OverBought13.SetLineWeight(3);
def over_bought14 = 140;
plot OverBought14 = over_bought14;
OverBought14.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought14.SetStyle(Curve.LONG_DASH);
OverBought14.SetLineWeight(3);
def over_bought15 = 150;
plot OverBought15 = over_bought15;
OverBought15.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought15.SetStyle(Curve.LONG_DASH);
OverBought15.SetLineWeight(3);
def over_bought16 = 160;
plot OverBought16 = over_bought16;
OverBought16.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
OverBought16.SetStyle(Curve.LONG_DASH);
OverBought16.SetLineWeight(3);
input symbol0 = "DIA";
input symbol = "SPY";
input symbol1 = "QQQ";
input symbol2 = "IWM";
input symbol3 = "XLB";
input symbol4 = "XLC";
input symbol5 = "XLE";
input symbol6 = "XLF";
input symbol7 = "XLI";
input symbol8 = "XLK";
input symbol9 = "XLP";
input symbol10 = "XLU";
input symbol11 = "XLV";
input symbol12 = "XLY";
input symbol13 = "XRT";
input symbol14 = "XHB";
input symbol15 = "IYT";
input symbol16 = "VIX";
def length = 20;
def Num_Dev_Dn = -2.0;
def Num_Dev_up = 2.0;
def averageType = AverageType.SIMPLE;
def factorhigh = 1.0;
def factormid = 1.5;
def factorlow = 2.0;
def trueRangeAverageType = AverageType.SIMPLE;
#def displace = 0;
def sDev0 = StDev(data = close(symbol0), length = length);
def MidLineBB0 = MovingAverage(averageType, data = close(symbol0), length = length);
def LowerBand0BB0 = MidLineBB0 + Num_Dev_Dn * sDev0;
def UpperBand0BB0 = MidLineBB0 + Num_Dev_up * sDev0;
def shift0high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol0), close(symbol0), low(symbol0)), length);
def shift0Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol0), close(symbol0), low(symbol0)), length);
def shift0low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol0), close(symbol0), low(symbol0)), length);
def average0 = MovingAverage(averageType, close(symbol0), length);
def Avg0 = average0;
def UpperBand0KCLow = average0 + shift0low;
def LowerBand0KCLow = average0 - shift0low;
def UpperBand0KCMid = average0 + shift0Mid;
def LowerBand0KCMid = average0 - shift0Mid;
def UpperBand0KCHigh = average0 + shift0high;
def LowerBand0KCHigh = average0 - shift0high;
def preSqueeze0 = LowerBand0BB0 > LowerBand0KCLow and UpperBand0BB0 < UpperBand0KCLow;
def originalSqueeze0 = LowerBand0BB0 > LowerBand0KCMid and UpperBand0BB0 < UpperBand0KCMid;
def ExtrSqueeze0 = LowerBand0BB0 > LowerBand0KCHigh and UpperBand0BB0 < UpperBand0KCHigh;
OverBought0.AssignValueColor(if ExtrSqueeze0 then Color.Cyan else if originalSqueeze0 then Color.Magenta else if preSqueeze0 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "DIA", if ExtrSqueeze0 then Color.Cyan else if originalSqueeze0 then Color.Magenta else if preSqueeze0 then Color.DARK_ORANGE else Color.GRAY);
##########SPY
def sDev = StDev(data = close(symbol), length = length);
def MidLineBB = MovingAverage(averageType, data = close(symbol), length = length);
def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev;
def UpperBandBB = MidLineBB + Num_Dev_up * sDev;
def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol), close(symbol), low(symbol)), length);
def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol), close(symbol), low(symbol)), length);
def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol), close(symbol), low(symbol)), length);
def average = MovingAverage(averageType, close(symbol), length);
def Avg = average;
def UpperBandKCLow = average + shiftlow;
def LowerBandKCLow = average - shiftlow;
def UpperBandKCMid = average + shiftMid;
def LowerBandKCMid = average - shiftMid;
def UpperBandKCHigh = average + shifthigh;
def LowerBandKCHigh = average - shifthigh;
def presqueeze = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow;
def originalSqueeze = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid;
def ExtrSqueeze = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh;
OverBought.AssignValueColor(if ExtrSqueeze then Color.Cyan else if originalSqueeze then Color.Magenta else if presqueeze then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "SPY", if ExtrSqueeze then Color.Cyan else if originalSqueeze then Color.Magenta else if presqueeze then Color.DARK_ORANGE else Color.GRAY);
def sDev1 = StDev(data = close(symbol1), length = length);
def MidLineBB1 = MovingAverage(averageType, data = close(symbol1), length = length);
def LowerBand1BB1 = MidLineBB1 + Num_Dev_Dn * sDev1;
def UpperBand1BB1 = MidLineBB1 + Num_Dev_up * sDev1;
def shift1high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol1), close(symbol1), low(symbol1)), length);
def shift1Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol1), close(symbol1), low(symbol1)), length);
def shift1low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol1), close(symbol1), low(symbol1)), length);
def average1 = MovingAverage(averageType, close(symbol1), length);
def Avg1 = average1;
def UpperBand1KCLow = average1 + shift1low;
def LowerBand1KCLow = average1 - shift1low;
def UpperBand1KCMid = average1 + shift1Mid;
def LowerBand1KCMid = average1 - shift1Mid;
def UpperBand1KCHigh = average1 + shift1high;
def LowerBand1KCHigh = average1 - shift1high;
def preSqueeze1 = LowerBand1BB1 > LowerBand1KCLow and UpperBand1BB1 < UpperBand1KCLow;
def originalSqueeze1 = LowerBand1BB1 > LowerBand1KCMid and UpperBand1BB1 < UpperBand1KCMid;
def ExtrSqueeze1 = LowerBand1BB1 > LowerBand1KCHigh and UpperBand1BB1 < UpperBand1KCHigh;
OverBought1.AssignValueColor(if ExtrSqueeze1 then Color.Cyan else if originalSqueeze1 then Color.Magenta else if preSqueeze1 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "QQQ", if ExtrSqueeze1 then Color.Cyan else if originalSqueeze1 then Color.Magenta else if preSqueeze1 then Color.DARK_ORANGE else Color.GRAY);
def sDev2 = StDev(data = close(symbol2), length = length);
def MidLineBB2 = MovingAverage(averageType, data = close(symbol2), length = length);
def LowerBand2BB2 = MidLineBB2 + Num_Dev_Dn * sDev2;
def UpperBand2BB2 = MidLineBB2 + Num_Dev_up * sDev2;
def shift2high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol2), close(symbol2), low(symbol2)), length);
def shift2Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol2), close(symbol2), low(symbol2)), length);
def shift2low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol2), close(symbol2), low(symbol2)), length);
def average2 = MovingAverage(averageType, close(symbol2), length);
def Avg2 = average2;
def UpperBand2KCLow = average2 + shift2low;
def LowerBand2KCLow = average2 - shift2low;
def UpperBand2KCMid = average2 + shift2Mid;
def LowerBand2KCMid = average2 - shift2Mid;
def UpperBand2KCHigh = average2 + shift2high;
def LowerBand2KCHigh = average2 - shift2high;
def preSqueeze2 = LowerBand2BB2 > LowerBand2KCLow and UpperBand2BB2 < UpperBand2KCLow;
def originalSqueeze2 = LowerBand2BB2 > LowerBand2KCMid and UpperBand2BB2 < UpperBand2KCMid;
def ExtrSqueeze2 = LowerBand2BB2 > LowerBand2KCHigh and UpperBand2BB2 < UpperBand2KCHigh;
OverBought2.AssignValueColor(if ExtrSqueeze2 then Color.Cyan else if originalSqueeze2 then Color.Magenta else if preSqueeze2 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "IWM", if ExtrSqueeze2 then Color.Cyan else if originalSqueeze2 then Color.Magenta else if preSqueeze2 then Color.DARK_ORANGE else Color.GRAY);
def sDev3 = StDev(data = close(symbol3), length = length);
def MidLineBB3 = MovingAverage(averageType, data = close(symbol3), length = length);
def LowerBand3BB3 = MidLineBB3 + Num_Dev_Dn * sDev3;
def UpperBand3BB3 = MidLineBB3 + Num_Dev_up * sDev3;
def shift3high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol3), close(symbol3), low(symbol3)), length);
def shift3Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol3), close(symbol3), low(symbol3)), length);
def shift3low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol3), close(symbol3), low(symbol3)), length);
def average3 = MovingAverage(averageType, close(symbol3), length);
def Avg3 = average3;
def UpperBand3KCLow = average3 + shift3low;
def LowerBand3KCLow = average3 - shift3low;
def UpperBand3KCMid = average3 + shift3Mid;
def LowerBand3KCMid = average3 - shift3Mid;
def UpperBand3KCHigh = average3 + shift3high;
def LowerBand3KCHigh = average3 - shift3high;
def preSqueeze3 = LowerBand3BB3 > LowerBand3KCLow and UpperBand3BB3 < UpperBand3KCLow;
def originalSqueeze3 = LowerBand3BB3 > LowerBand3KCMid and UpperBand3BB3 < UpperBand3KCMid;
def ExtrSqueeze3 = LowerBand3BB3 > LowerBand3KCHigh and UpperBand3BB3 < UpperBand3KCHigh;
OverBought3.AssignValueColor(if ExtrSqueeze3 then Color.Cyan else if originalSqueeze3 then Color.Magenta else if preSqueeze3 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLB", if ExtrSqueeze3 then Color.Cyan else if originalSqueeze3 then Color.Magenta else if preSqueeze3 then Color.DARK_ORANGE else Color.GRAY);
def sDev4 = StDev(data = close(symbol4), length = length);
def MidLineBB4 = MovingAverage(averageType, data = close(symbol4), length = length);
def LowerBand4BB4 = MidLineBB4 + Num_Dev_Dn * sDev4;
def UpperBand4BB4 = MidLineBB4 + Num_Dev_up * sDev4;
def shift4high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol4), close(symbol4), low(symbol4)), length);
def shift4Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol4), close(symbol4), low(symbol4)), length);
def shift4low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol4), close(symbol4), low(symbol4)), length);
def average4 = MovingAverage(averageType, close(symbol4), length);
def Avg4 = average4;
def UpperBand4KCLow = average4 + shift4low;
def LowerBand4KCLow = average4 - shift4low;
def UpperBand4KCMid = average4 + shift4Mid;
def LowerBand4KCMid = average4 - shift4Mid;
def UpperBand4KCHigh = average4 + shift4high;
def LowerBand4KCHigh = average4 - shift4high;
def preSqueeze4 = LowerBand4BB4 > LowerBand4KCLow and UpperBand4BB4 < UpperBand4KCLow;
def originalSqueeze4 = LowerBand4BB4 > LowerBand4KCMid and UpperBand4BB4 < UpperBand4KCMid;
def ExtrSqueeze4 = LowerBand4BB4 > LowerBand4KCHigh and UpperBand4BB4 < UpperBand4KCHigh;
OverBought4.AssignValueColor(if ExtrSqueeze4 then Color.Cyan else if originalSqueeze4 then Color.Magenta else if preSqueeze4 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLC", if ExtrSqueeze4 then Color.Cyan else if originalSqueeze4 then Color.Magenta else if preSqueeze4 then Color.DARK_ORANGE else Color.GRAY);
def sDev5 = StDev(data = close(symbol5), length = length);
def MidLineBB5 = MovingAverage(averageType, data = close(symbol5), length = length);
def LowerBand5BB5 = MidLineBB5 + Num_Dev_Dn * sDev5;
def UpperBand5BB5 = MidLineBB5 + Num_Dev_up * sDev5;
def shift5high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol5), close(symbol5), low(symbol5)), length);
def shift5Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol5), close(symbol5), low(symbol5)), length);
def shift5low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol5), close(symbol5), low(symbol5)), length);
def average5 = MovingAverage(averageType, close(symbol5), length);
def Avg5 = average5;
def UpperBand5KCLow = average5 + shift5low;
def LowerBand5KCLow = average5 - shift5low;
def UpperBand5KCMid = average5 + shift5Mid;
def LowerBand5KCMid = average5 - shift5Mid;
def UpperBand5KCHigh = average5 + shift5high;
def LowerBand5KCHigh = average5 - shift5high;
def preSqueeze5 = LowerBand5BB5 > LowerBand5KCLow and UpperBand5BB5 < UpperBand5KCLow;
def originalSqueeze5 = LowerBand5BB5 > LowerBand5KCMid and UpperBand5BB5 < UpperBand5KCMid;
def ExtrSqueeze5 = LowerBand5BB5 > LowerBand5KCHigh and UpperBand5BB5 < UpperBand5KCHigh;
OverBought5.AssignValueColor(if ExtrSqueeze5 then Color.Cyan else if originalSqueeze5 then Color.Magenta else if preSqueeze5 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLE", if ExtrSqueeze5 then Color.Cyan else if originalSqueeze5 then Color.Magenta else if preSqueeze5 then Color.DARK_ORANGE else Color.GRAY);
def sDev6 = StDev(data = close(symbol6), length = length);
def MidLineBB6 = MovingAverage(averageType, data = close(symbol6), length = length);
def LowerBand6BB6 = MidLineBB6 + Num_Dev_Dn * sDev6;
def UpperBand6BB6 = MidLineBB6 + Num_Dev_up * sDev6;
def shift6high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol6), close(symbol6), low(symbol6)), length);
def shift6Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol6), close(symbol6), low(symbol6)), length);
def shift6low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol6), close(symbol6), low(symbol6)), length);
def average6 = MovingAverage(averageType, close(symbol6), length);
def Avg6 = average6;
def UpperBand6KCLow = average6 + shift6low;
def LowerBand6KCLow = average6 - shift6low;
def UpperBand6KCMid = average6 + shift6Mid;
def LowerBand6KCMid = average6 - shift6Mid;
def UpperBand6KCHigh = average6 + shift6high;
def LowerBand6KCHigh = average6 - shift6high;
def preSqueeze6 = LowerBand6BB6 > LowerBand6KCLow and UpperBand6BB6 < UpperBand6KCLow;
def originalSqueeze6 = LowerBand6BB6 > LowerBand6KCMid and UpperBand6BB6 < UpperBand6KCMid;
def ExtrSqueeze6 = LowerBand6BB6 > LowerBand6KCHigh and UpperBand6BB6 < UpperBand6KCHigh;
OverBought6.AssignValueColor(if ExtrSqueeze6 then Color.Cyan else if originalSqueeze6 then Color.Magenta else if preSqueeze6 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLF", if ExtrSqueeze6 then Color.Cyan else if originalSqueeze6 then Color.Magenta else if preSqueeze6 then Color.DARK_ORANGE else Color.GRAY);
def sDev7 = StDev(data = close(symbol7), length = length);
def MidLineBB7 = MovingAverage(averageType, data = close(symbol7), length = length);
def LowerBand7BB7 = MidLineBB7 + Num_Dev_Dn * sDev7;
def UpperBand7BB7 = MidLineBB7 + Num_Dev_up * sDev7;
def shift7high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol7), close(symbol7), low(symbol7)), length);
def shift7Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol7), close(symbol7), low(symbol7)), length);
def shift7low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol7), close(symbol7), low(symbol7)), length);
def average7 = MovingAverage(averageType, close(symbol7), length);
def Avg7 = average7;
def UpperBand7KCLow = average7 + shift7low;
def LowerBand7KCLow = average7 - shift7low;
def UpperBand7KCMid = average7 + shift7Mid;
def LowerBand7KCMid = average7 - shift7Mid;
def UpperBand7KCHigh = average7 + shift7high;
def LowerBand7KCHigh = average7 - shift7high;
def preSqueeze7 = LowerBand7BB7 > LowerBand7KCLow and UpperBand7BB7 < UpperBand7KCLow;
def originalSqueeze7 = LowerBand7BB7 > LowerBand7KCMid and UpperBand7BB7 < UpperBand7KCMid;
def ExtrSqueeze7 = LowerBand7BB7 > LowerBand7KCHigh and UpperBand7BB7 < UpperBand7KCHigh;
OverBought7.AssignValueColor(if ExtrSqueeze7 then Color.Cyan else if originalSqueeze7 then Color.Magenta else if preSqueeze7 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLI", if ExtrSqueeze7 then Color.Cyan else if originalSqueeze7 then Color.Magenta else if preSqueeze7 then Color.DARK_ORANGE else Color.GRAY);
def sDev8 = StDev(data = close(symbol8), length = length);
def MidLineBB8 = MovingAverage(averageType, data = close(symbol8), length = length);
def LowerBand8BB8 = MidLineBB8 + Num_Dev_Dn * sDev8;
def UpperBand8BB8 = MidLineBB8 + Num_Dev_up * sDev8;
def shift8high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol8), close(symbol8), low(symbol8)), length);
def shift8Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol8), close(symbol8), low(symbol8)), length);
def shift8low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol8), close(symbol8), low(symbol8)), length);
def average8 = MovingAverage(averageType, close(symbol8), length);
def Avg8 = average8;
def UpperBand8KCLow = average8 + shift8low;
def LowerBand8KCLow = average8 - shift8low;
def UpperBand8KCMid = average8 + shift8Mid;
def LowerBand8KCMid = average8 - shift8Mid;
def UpperBand8KCHigh = average8 + shift8high;
def LowerBand8KCHigh = average8 - shift8high;
def preSqueeze8 = LowerBand8BB8 > LowerBand8KCLow and UpperBand8BB8 < UpperBand8KCLow;
def originalSqueeze8 = LowerBand8BB8 > LowerBand8KCMid and UpperBand8BB8 < UpperBand8KCMid;
def ExtrSqueeze8 = LowerBand8BB8 > LowerBand8KCHigh and UpperBand8BB8 < UpperBand8KCHigh;
OverBought8.AssignValueColor(if ExtrSqueeze8 then Color.Cyan else if originalSqueeze8 then Color.Magenta else if preSqueeze8 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLK", if ExtrSqueeze8 then Color.Cyan else if originalSqueeze8 then Color.Magenta else if preSqueeze8 then Color.DARK_ORANGE else Color.GRAY);
def sDev9 = StDev(data = close(symbol9), length = length);
def MidLineBB9 = MovingAverage(averageType, data = close(symbol9), length = length);
def LowerBand9BB9 = MidLineBB9 + Num_Dev_Dn * sDev9;
def UpperBand9BB9 = MidLineBB9 + Num_Dev_up * sDev9;
def shift9high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol9), close(symbol9), low(symbol9)), length);
def shift9Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol9), close(symbol9), low(symbol9)), length);
def shift9low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol9), close(symbol9), low(symbol9)), length);
def average9 = MovingAverage(averageType, close(symbol9), length);
def Avg9 = average9;
def UpperBand9KCLow = average9 + shift9low;
def LowerBand9KCLow = average9 - shift9low;
def UpperBand9KCMid = average9 + shift9Mid;
def LowerBand9KCMid = average9 - shift9Mid;
def UpperBand9KCHigh = average9 + shift9high;
def LowerBand9KCHigh = average9 - shift9high;
def preSqueeze9 = LowerBand9BB9 > LowerBand9KCLow and UpperBand9BB9 < UpperBand9KCLow;
def originalSqueeze9 = LowerBand9BB9 > LowerBand9KCMid and UpperBand9BB9 < UpperBand9KCMid;
def ExtrSqueeze9 = LowerBand9BB9 > LowerBand9KCHigh and UpperBand9BB9 < UpperBand9KCHigh;
OverBought9.AssignValueColor(if ExtrSqueeze9 then Color.Cyan else if originalSqueeze9 then Color.Magenta else if preSqueeze9 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLP", if ExtrSqueeze9 then Color.Cyan else if originalSqueeze9 then Color.Magenta else if preSqueeze9 then Color.DARK_ORANGE else Color.GRAY);
def sDev10 = StDev(data = close(symbol10), length = length);
def MidLineBB10 = MovingAverage(averageType, data = close(symbol10), length = length);
def LowerBand10BB10 = MidLineBB10 + Num_Dev_Dn * sDev10;
def UpperBand10BB10 = MidLineBB10 + Num_Dev_up * sDev10;
def shift10high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol10), close(symbol10), low(symbol10)), length);
def shift10Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol10), close(symbol10), low(symbol10)), length);
def shift10low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol10), close(symbol10), low(symbol10)), length);
def average10 = MovingAverage(averageType, close(symbol10), length);
def Avg10 = average10;
def UpperBand10KCLow = average10 + shift10low;
def LowerBand10KCLow = average10 - shift10low;
def UpperBand10KCMid = average10 + shift10Mid;
def LowerBand10KCMid = average10 - shift10Mid;
def UpperBand10KCHigh = average10 + shift10high;
def LowerBand10KCHigh = average10 - shift10high;
def preSqueeze10 = LowerBand10BB10 > LowerBand10KCLow and UpperBand10BB10 < UpperBand10KCLow;
def originalSqueeze10 = LowerBand10BB10 > LowerBand10KCMid and UpperBand10BB10 < UpperBand10KCMid;
def ExtrSqueeze10 = LowerBand10BB10 > LowerBand10KCHigh and UpperBand10BB10 < UpperBand10KCHigh;
OverBought10.AssignValueColor(if ExtrSqueeze10 then Color.Cyan else if originalSqueeze10 then Color.Magenta else if preSqueeze10 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLU", if ExtrSqueeze10 then Color.Cyan else if originalSqueeze10 then Color.Magenta else if preSqueeze10 then Color.DARK_ORANGE else Color.GRAY);
def sDev11 = StDev(data = close(symbol11), length = length);
def MidLineBB11 = MovingAverage(averageType, data = close(symbol11), length = length);
def LowerBand11BB11 = MidLineBB11 + Num_Dev_Dn * sDev11;
def UpperBand11BB11 = MidLineBB11 + Num_Dev_up * sDev11;
def shift11high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol11), close(symbol11), low(symbol11)), length);
def shift11Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol11), close(symbol11), low(symbol11)), length);
def shift11low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol11), close(symbol11), low(symbol11)), length);
def average11 = MovingAverage(averageType, close(symbol11), length);
def Avg11 = average11;
def UpperBand11KCLow = average11 + shift11low;
def LowerBand11KCLow = average11 - shift11low;
def UpperBand11KCMid = average11 + shift11Mid;
def LowerBand11KCMid = average11 - shift11Mid;
def UpperBand11KCHigh = average11 + shift11high;
def LowerBand11KCHigh = average11 - shift11high;
def preSqueeze11 = LowerBand11BB11 > LowerBand11KCLow and UpperBand11BB11 < UpperBand11KCLow;
def originalSqueeze11 = LowerBand11BB11 > LowerBand11KCMid and UpperBand11BB11 < UpperBand11KCMid;
def ExtrSqueeze11 = LowerBand11BB11 > LowerBand11KCHigh and UpperBand11BB11 < UpperBand11KCHigh;
OverBought11.AssignValueColor(if ExtrSqueeze11 then Color.Cyan else if originalSqueeze11 then Color.Magenta else if preSqueeze11 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLV", if ExtrSqueeze11 then Color.Cyan else if originalSqueeze11 then Color.Magenta else if preSqueeze11 then Color.DARK_ORANGE else Color.GRAY);
def sDev12 = StDev(data = close(symbol12), length = length);
def MidLineBB12 = MovingAverage(averageType, data = close(symbol12), length = length);
def LowerBand12BB12 = MidLineBB12 + Num_Dev_Dn * sDev12;
def UpperBand12BB12 = MidLineBB12 + Num_Dev_up * sDev12;
def shift12high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol12), close(symbol12), low(symbol12)), length);
def shift12Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol12), close(symbol12), low(symbol12)), length);
def shift12low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol12), close(symbol12), low(symbol12)), length);
def average12 = MovingAverage(averageType, close(symbol12), length);
def Avg12 = average12;
def UpperBand12KCLow = average12 + shift12low;
def LowerBand12KCLow = average12 - shift12low;
def UpperBand12KCMid = average12 + shift12Mid;
def LowerBand12KCMid = average12 - shift12Mid;
def UpperBand12KCHigh = average12 + shift12high;
def LowerBand12KCHigh = average12 - shift12high;
def preSqueeze12 = LowerBand12BB12 > LowerBand12KCLow and UpperBand12BB12 < UpperBand12KCLow;
def originalSqueeze12 = LowerBand12BB12 > LowerBand12KCMid and UpperBand12BB12 < UpperBand12KCMid;
def ExtrSqueeze12 = LowerBand12BB12 > LowerBand12KCHigh and UpperBand12BB12 < UpperBand12KCHigh;
OverBought12.AssignValueColor(if ExtrSqueeze12 then Color.Cyan else if originalSqueeze12 then Color.Magenta else if preSqueeze12 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XLY", if ExtrSqueeze12 then Color.Cyan else if originalSqueeze12 then Color.Magenta else if preSqueeze12 then Color.DARK_ORANGE else Color.GRAY);
def sDev13 = StDev(data = close(symbol13), length = length);
def MidLineBB13 = MovingAverage(averageType, data = close(symbol13), length = length);
def LowerBand13BB13 = MidLineBB13 + Num_Dev_Dn * sDev13;
def UpperBand13BB13 = MidLineBB13 + Num_Dev_up * sDev13;
def shift13high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol13), close(symbol13), low(symbol13)), length);
def shift13Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol13), close(symbol13), low(symbol13)), length);
def shift13low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol13), close(symbol13), low(symbol13)), length);
def average13 = MovingAverage(averageType, close(symbol13), length);
def Avg13 = average13;
def UpperBand13KCLow = average13 + shift13low;
def LowerBand13KCLow = average13 - shift13low;
def UpperBand13KCMid = average13 + shift13Mid;
def LowerBand13KCMid = average13 - shift13Mid;
def UpperBand13KCHigh = average13 + shift13high;
def LowerBand13KCHigh = average13 - shift13high;
def preSqueeze13 = LowerBand13BB13 > LowerBand13KCLow and UpperBand13BB13 < UpperBand13KCLow;
def originalSqueeze13 = LowerBand13BB13 > LowerBand13KCMid and UpperBand13BB13 < UpperBand13KCMid;
def ExtrSqueeze13 = LowerBand13BB13 > LowerBand13KCHigh and UpperBand13BB13 < UpperBand13KCHigh;
OverBought13.AssignValueColor(if ExtrSqueeze13 then Color.Cyan else if originalSqueeze13 then Color.Magenta else if preSqueeze13 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XRT", if ExtrSqueeze13 then Color.Cyan else if originalSqueeze13 then Color.Magenta else if preSqueeze13 then Color.DARK_ORANGE else Color.GRAY);
def sDev14 = StDev(data = close(symbol14), length = length);
def MidLineBB14 = MovingAverage(averageType, data = close(symbol14), length = length);
def LowerBand14BB14 = MidLineBB14 + Num_Dev_Dn * sDev14;
def UpperBand14BB14 = MidLineBB14 + Num_Dev_up * sDev14;
def shift14high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol14), close(symbol14), low(symbol14)), length);
def shift14Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol14), close(symbol14), low(symbol14)), length);
def shift14low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol14), close(symbol14), low(symbol14)), length);
def average14 = MovingAverage(averageType, close(symbol14), length);
def Avg14 = average14;
def UpperBand14KCLow = average14 + shift14low;
def LowerBand14KCLow = average14 - shift14low;
def UpperBand14KCMid = average14 + shift14Mid;
def LowerBand14KCMid = average14 - shift14Mid;
def UpperBand14KCHigh = average14 + shift14high;
def LowerBand14KCHigh = average14 - shift14high;
def preSqueeze14 = LowerBand14BB14 > LowerBand14KCLow and UpperBand14BB14 < UpperBand14KCLow;
def originalSqueeze14 = LowerBand14BB14 > LowerBand14KCMid and UpperBand14BB14 < UpperBand14KCMid;
def ExtrSqueeze14 = LowerBand14BB14 > LowerBand14KCHigh and UpperBand14BB14 < UpperBand14KCHigh;
OverBought14.AssignValueColor(if ExtrSqueeze14 then Color.Cyan else if originalSqueeze14 then Color.Magenta else if preSqueeze14 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "XHB", if ExtrSqueeze14 then Color.Cyan else if originalSqueeze14 then Color.Magenta else if preSqueeze14 then Color.DARK_ORANGE else Color.GRAY);
def sDev15 = StDev(data = close(symbol15), length = length);
def MidLineBB15 = MovingAverage(averageType, data = close(symbol15), length = length);
def LowerBand15BB15 = MidLineBB15 + Num_Dev_Dn * sDev15;
def UpperBand15BB15 = MidLineBB15 + Num_Dev_up * sDev15;
def shift15high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol15), close(symbol15), low(symbol15)), length);
def shift15Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol15), close(symbol15), low(symbol15)), length);
def shift15low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol15), close(symbol15), low(symbol15)), length);
def average15 = MovingAverage(averageType, close(symbol15), length);
def Avg15 = average15;
def UpperBand15KCLow = average15 + shift15low;
def LowerBand15KCLow = average15 - shift15low;
def UpperBand15KCMid = average15 + shift15Mid;
def LowerBand15KCMid = average15 - shift15Mid;
def UpperBand15KCHigh = average15 + shift15high;
def LowerBand15KCHigh = average15 - shift15high;
def preSqueeze15 = LowerBand15BB15 > LowerBand15KCLow and UpperBand15BB15 < UpperBand15KCLow;
def originalSqueeze15 = LowerBand15BB15 > LowerBand15KCMid and UpperBand15BB15 < UpperBand15KCMid;
def ExtrSqueeze15 = LowerBand15BB15 > LowerBand15KCHigh and UpperBand15BB15 < UpperBand15KCHigh;
OverBought15.AssignValueColor(if ExtrSqueeze15 then Color.Cyan else if originalSqueeze15 then Color.Magenta else if preSqueeze15 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "IYT", if ExtrSqueeze15 then Color.Cyan else if originalSqueeze15 then Color.Magenta else if preSqueeze15 then Color.DARK_ORANGE else Color.GRAY);
def sDev16 = StDev(data = close(symbol16), length = length);
def MidLineBB16 = MovingAverage(averageType, data = close(symbol16), length = length);
def LowerBand16BB16 = MidLineBB16 + Num_Dev_Dn * sDev16;
def UpperBand16BB16 = MidLineBB16 + Num_Dev_up * sDev16;
def shift16high = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high(symbol16), close(symbol16), low(symbol16)), length);
def shift16Mid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high(symbol16), close(symbol16), low(symbol16)), length);
def shift16low = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high(symbol16), close(symbol16), low(symbol16)), length);
def average16 = MovingAverage(averageType, close(symbol16), length);
def Avg16 = average16;
def UpperBand16KCLow = average16 + shift16low;
def LowerBand16KCLow = average16 - shift16low;
def UpperBand16KCMid = average16 + shift16Mid;
def LowerBand16KCMid = average16 - shift16Mid;
def UpperBand16KCHigh = average16 + shift16high;
def LowerBand16KCHigh = average16 - shift16high;
def preSqueeze16 = LowerBand16BB16 > LowerBand16KCLow and UpperBand16BB16 < UpperBand16KCLow;
def originalSqueeze16 = LowerBand16BB16 > LowerBand16KCMid and UpperBand16BB16 < UpperBand16KCMid;
def ExtrSqueeze16 = LowerBand16BB16 > LowerBand16KCHigh and UpperBand16BB16 < UpperBand16KCHigh;
OverBought16.AssignValueColor(if ExtrSqueeze16 then Color.Cyan else if originalSqueeze16 then Color.Magenta else if preSqueeze16 then Color.DARK_ORANGE else Color.GRAY);
AddLabel(yes, "VIX", if ExtrSqueeze16 then Color.Cyan else if originalSqueeze16 then Color.Magenta else if preSqueeze16 then Color.DARK_ORANGE else Color.GRAY);