In order to do this properly I will have to recreate the entire chart study by referencing the plots from the original. In this way I can replicate the appearance of the original without having to access the source code (which is not available on Thinkorswim). I will also include user inputs to adjust the length of the moving average as well as the type.
Having done all of that in lines 1 through 19, I then add the moving average plot as the final line in the code.
The only detail missing from this is the alert that is included with the original. (I simply ran out of time and was not able to included that feature with this solution).
Here is the code that displays the TTM_Squeeze and adds the moving average plot:
declare lower;
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
input maLengthOne = 20;
input maTypeOne = AverageType.EXPONENTIAL;
plot sqzHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
sqzHistogram.AssignValueColor(if sqzHistogram < 0 then if sqzHistogram > sqzHistogram[1] then Color.YELLOW else Color.RED else
if sqzHistogram > sqzHistogram[1] then Color.CYAN else Color.BLUE);
sqzHistogram.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sqzHistogram.SetLineWeight(3);
def sqzAlert = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
plot volComp = TTM_Squeeze(price, length, nK, nBB, alertLine).VolComp;
volComp.AssignValueColor(if sqzAlert then Color.GREEN else Color.RED);
volComp.SetPaintingStrategy(PaintingStrategy.POINTS);
volComp.SetLineWeight(3);
plot histogramAverage = MovingAverage(maTypeOne, sqzHistogram, maLengthOne);
The screenshot below shows the end result. (I have included the built-in version of TTM_Squeeze along with the custom version displayed in the bottom of the chart. This allows viewers to confirm everything matches the original).