dunpeal
New member
Has histo colors, squeeze count, and how long ago a squeeze fired. I like ordering the column numerically as you can see in the Daily. Now I can watch whatever time frame and see what has fired. You can look left on the small time frames and get an idea of which direction it fired. Exampled is DLTR, fired on the daily and went down on the 30m,1hr,4hr.
DUK will be an interesting one coming up with earnings.
https://tos.mx/UA6QBwB
DUK will be an interesting one coming up with earnings.
Code:
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def keltnerChannelATRs = 1.5 ;
def bollingerBandStdDev = 2 ;
# Average True Range
def ATR = Average(TrueRange(high, close, low), 20);
# Standard Deviation
def SDev = StDev(close, 20);
# -- Calculate Bollinger Band Squeeze Indicator --
# for alert
def Denom = (keltnerChannelATRs * ATR);
def BBS_Ind = If (Denom <> 0, ((bollingerBandStdDev * SDev) / Denom), 0);#A squeeze is on if BBS_Ind < 1.0
def squeeze = if TTM_Squeeze().SqueezeAlert == 0 then 1 else 0;
def sumSqueeze = Sum(squeeze, 10);
def squeezeFired = if TTM_Squeeze().SqueezeAlert[1] == 0 and TTM_Squeeze(). SqueezeAlert == 1 then 1 else 0;
AddLabel (squeezeFired, "FIRED", color.black);
AddLabel (squeeze, +sumSqueeze, color.black);
AddLabel (!squeezeFired and !squeeze, " ", color.black);
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
plot hist = if squeezeHistogram>= 0 then
if squeezeHistogram> squeezeHistogram[1] then 2 else 1
else if squeezeHistogram < squeezeHistogram[1] then -2 else -1; assignBackgroundColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then color.CYAN else color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then color.RED
else color.YELLOW); hist.assignvaluecolor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then color.CYAN else color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then color.RED
else color.YELLOW);
#### How long ago the squeeze fired
def Post_Count = if BBS_Ind[1] < 1.0 && BBS_Ind[0] > 1.0 then 1
else if BBS_Ind[2] < 1.0 && BBS_Ind[1] > 1.0 then 2
else if BBS_Ind[3] < 1.0 && BBS_Ind[2] > 1.0 then 3
else if BBS_Ind[4] < 1.0 && BBS_Ind[3] > 1.0 then 4
else if BBS_Ind[5] < 1.0 && BBS_Ind[4] > 1.0 then 5
else if BBS_Ind[6] < 1.0 && BBS_Ind[5] > 1.0 then 6
else Double.NaN;
AddLabel (Post_Count,Concat("-", Concat(Post_Count, " ago")), color.BLACK);
AddLabel (!squeezeFired and !squeeze, " ", color.black);