declare lower;
input AP1 = AggregationPeriod.DAY;
input AP2 = AggregationPeriod.TWO_DAYS;
input AP3 = AggregationPeriod.THREE_DAYS;
input AP4 = AggregationPeriod.FOUR_DAYS;
input AP5 = AggregationPeriod.WEEK;
input AP6 = AggregationPeriod.MONTH;
input vote = 3;
def price1 = CLOSE(period = AP1);
def price2 = CLOSE(period = AP2);
def price3 = CLOSE(period = AP3);
def price4 = CLOSE(period = AP4);
def price5 = CLOSE(period = AP5);
def price6 = CLOSE(period = AP6);
def length = 20;
def nK = 1.5;
def nBB = 2.0;
def alertLine = 1.0;
def Sqz_Length = 3;
def squeezeDots1 = TTM_Squeeze(price1, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots2 = TTM_Squeeze(price2, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots3 = TTM_Squeeze(price3, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots4 = TTM_Squeeze(price4, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots5 = TTM_Squeeze(price5, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots6 = TTM_Squeeze(price6, length, nK, nBB, alertLine).SqueezeAlert;
def Top_Plot = (squeezeDots1 + squeezeDots2 + squeezeDots3 + squeezeDots4 + squeezeDots5 +squeezeDots6) >= Vote;
plot MTF_Sqz = 7;
MTF_Sqz.SetPaintingStrategy(PaintingStrategy.POINTS);
MTF_Sqz.AssignValueColor(if Top_Plot == 1 then Color.BLACK else Color.DARK_RED);
MTF_Sqz.SetLineWeight(5);
plot Sqeezy1 = if squeezeDots1 == 1 then squeezeDots1 + 5 else 6;
plot Sqeezy2 = if squeezeDots2 == 1 then squeezeDots2 + 4 else 5;
plot Sqeezy3 = if squeezeDots3 == 1 then squeezeDots3 + 3 else 4;
plot Sqeezy4 = if squeezeDots4 == 1 then squeezeDots4 + 2 else 3;
plot Sqeezy5 = if squeezeDots5 == 1 then squeezeDots5 + 1 else 2;
plot Sqeezy6 = if squeezeDots6 == 1 then squeezeDots6 else 1;
Sqeezy1.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy1.AssignValueColor(if squeezeDots1 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy1.SetLineWeight(3);
Sqeezy2.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy2.AssignValueColor(if squeezeDots2 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy2.SetLineWeight(3);
Sqeezy3.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy3.AssignValueColor(if squeezeDots3 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy3.SetLineWeight(3);
Sqeezy4.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy4.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy4.SetLineWeight(3);
Sqeezy5.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy5.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy5.SetLineWeight(3);
Sqeezy6.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy6.AssignValueColor(if squeezeDots6 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy6.SetLineWeight(3);