Since you are asking for a chart label I moved your question out of the "Alerts and Notifications" topic and into the "Chart Studies" topic. I also updated the title of your question to help other viewers locate this post using the search function.
I only allocate 15 minutes to each free solution I provide in this forum. Within that time I was just barely able to complete the section that counts bars and displays that in a chart label. The rest of your request is well beyond the complexity of solutions I can provide free of charge in this forum.
Here is the solution which adds a label to the chart which shows the color of the current bar and the number of consecutive bar in the current color:
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
def sqzCyan = squeezeHistogram >= 0 and squeezeHistogram > squeezeHistogram[1];
def sqzBlue = squeezeHistogram >=0 and squeezeHistogram < squeezeHistogram[1];
def sqzRed = squeezeHistogram <= 0 and squeezeHistogram < squeezeHistogram[1];
def sqzYellow = squeezeHistogram <= 0 and squeezeHistogram > squeezeHistogram[1];
rec countCyan = if !sqzCyan then 0 else if sqzCyan and !sqzCyan[1] then 1 else if sqzCyan then countCyan[1] + 1 else countCyan[1];
rec countBlue = if !sqzBlue then 0 else if sqzBlue and !sqzBlue[1] then 1 else if sqzBlue then countBlue[1] + 1 else countBlue[1];
rec countRed = if !sqzRed then 0 else if sqzRed and !sqzRed[1] then 1 else if sqzRed then countRed[1] + 1 else countRed[1];
rec countYellow = if !sqzYellow then 0 else if sqzYellow and !sqzYellow[1] then 1 else if sqzYellow then countYellow[1] + 1 else countYellow[1];
def consecutiveBars = Max(countCyan, Max(countBlue, Max(countRed, countYellow)));
AddLabel(yes, Concat("Count: ", consecutiveBars), if sqzCyan then Color.CYAN else if sqzBlue then Color.BLUE else if sqzRed then Color.RED else if sqzYellow then Color.YELLOW else Color.CURRENT);