I updated the title of your question so that is describes exactly what you have requested. The previous title was too vague and could easily be confused with that previous post. This will also make it easier for the rest of our viewers to find this using the search function on the site.
Here is the code from that previous post, modified to generate the scan signal you requested. There are two user inputs in the first to lines. Adjusting those will set the minimum number of consecutive red dots immediately followed by the maximum number of green dots.
input numberOfRedDots = 3;
input numberOfGreenDots = 3;
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeDots = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
def alertCountGreen = if squeezeDots[1] == 0 and squeezeDots == 1 then 1 else if squeezeDots == 1 then alertCountGreen[1] + 1 else 0;
def alertCountRed = if squeezeDots[1] == 1 and squeezeDots == 0 then 1 else if squeezeDots == 0 then alertCountRed[1] + 1 else 0;
def consecutiveRedDots = alertCountRed >= numberOfRedDots;
def firstGreenAfterRed = alertCountGreen == 1 and consecutiveRedDots[1];
plot scan = alertCountGreen == numberOfGreenDots and consecutiveRedDots[numberOfRedDots];
Screenshot below shows the results.