```
###CollegeTrader
###CT_MTF_TTM_Squeeze_Replica
###
###Original TTM_Squeeze_Replica Code from Mobius
#hint:Helps identify periods of low volatility on multiple timeframes
Declare lower;
### Time Aggregations ############
input time1 = AggregationPeriod.five_min; #hint time1: Plot @ 0.
input time2 = AggregationPeriod.ten_min; #hint time2: Plot @ 0.5.
input time3 = AggregationPeriod.twenty_min; #hint time3: Plot @ 1.
input time4 = AggregationPeriod.hour; #hint time4: Plot @ 1.5.
### Master Plot On/Off ###########
input Master_Squeeze_Plot = Yes; #hint Master_Squeeze_Plot: Turns the master squeeze plot on or off.
### Time1 Squeeze Code ##############
input length = 20;
input AtrMult = 1.5;
input SdMult = 2.0;
def SD = StDev(close(period = time1), length);
def Avg = Average(close(period = time1), length);
def ATR = Average(TrueRange(high(period = time1), close(period = time1), low(period = time1)), length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze.SetLineWeight(4);
Squeeze.SetDefaultColor(Color.Red);
plot zero = if IsNaN(close(period = time1)) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.Points);
zero.SetLineWeight(4);
zero.SetDefaultColor(Color.Green);
### time2 Code #####################
def SD2 = StDev(close(period = time2), length);
def Avg2 = Average(close(period = time2), length);
def ATR2 = Average(TrueRange(high(period = time2), close(period = time2), low(period = time2)), length);
def SDup2 = Avg2 + (SdMult * Sd2);
def ATRup2 = Avg2 + (AtrMult * ATR2);
plot Squeeze2 = if SDup2 < ATRup2
then 0.5
else Double.NaN;
Squeeze2.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze2.SetLineWeight(4);
Squeeze2.SetDefaultColor(Color.Red);
plot zero2 = if IsNaN(close(period = time2)) or !IsNaN(Squeeze2) then Double.NaN else 0.5;
zero2.SetPaintingStrategy(PaintingStrategy.Points);
zero2.SetLineWeight(4);
zero2.SetDefaultColor(Color.Green);
### time3 Code ####################
def SD3 = StDev(close(period = time3), length);
def Avg3 = Average(close(period = time3), length);
def ATR3 = Average(TrueRange(high(period = time3), close(period = time3), low(period = time3)), length);
def SDup3 = Avg3 + (SdMult * Sd3);
def ATRup3 = Avg3 + (AtrMult * ATR3);
plot Squeeze3 = if SDup3 < ATRup3
then 1
else Double.NaN;
Squeeze3.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze3.SetLineWeight(4);
Squeeze3.SetDefaultColor(Color.Red);
plot zero3 = if IsNaN(close(period = time3)) or !IsNaN(Squeeze3) then Double.NaN else 1;
zero3.SetPaintingStrategy(PaintingStrategy.Points);
zero3.SetLineWeight(4);
zero3.SetDefaultColor(Color.Green);
### time4 Code ########################
def SD4 = StDev(close(period = time4), length);
def Avg4 = Average(close(period = time4), length);
def ATR4 = Average(TrueRange(high(period = time4), close(period = time4), low(period = time4)), length);
def SDup4 = Avg4 + (SdMult * Sd4);
def ATRup4 = Avg4 + (AtrMult * ATR4);
plot Squeeze4 = if SDup4 < ATRup4
then 1.5
else Double.NaN;
Squeeze4.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze4.SetLineWeight(4);
Squeeze4.SetDefaultColor(Color.Red);
plot zero4 = if IsNaN(close(period = time4)) or !IsNaN(Squeeze4) then Double.NaN else 1.5;
zero4.SetPaintingStrategy(PaintingStrategy.Points);
zero4.SetLineWeight(4);
zero4.SetDefaultColor(Color.Green);
### Master Squeeze Signal ################
plot line = if !IsNaN(close) and Master_Squeeze_Plot == Yes then 1.75 else Double.Nan;
line.SetPaintingStrategy(PaintingStrategy.Line);
line.SetLineWeight(5);
line.setdefaultcolor(color.white);
plot Master_Squeeze = if Master_Squeeze_Plot == Yes and ((SDup < ATRup) and (SDup2 < ATRup2) and (SDup3 < ATRup3) and (SDup4 < ATRup4))
then 2
else Double.NaN;
Master_Squeeze.SetPaintingStrategy(PaintingStrategy.Points);
Master_Squeeze.SetLineWeight(4);
Master_Squeeze.SetDefaultColor(Color.Red);
plot Master_Zero = if IsNaN(close) or !(SDup < ATRup) and !(SDup2 < ATRup2) and !(SDup3 < ATRup3) and !(SDup4 < ATRup4)
then Double.NaN
else if (Master_Squeeze_Plot == Yes) then 2
else Double.NaN;
Master_Zero.SetPaintingStrategy(PaintingStrategy.Points);
Master_Zero.SetLineWeight(4);
Master_Zero.SetDefaultColor(Color.Green);
```