I try to get a bubble with candle count when Hull(close,15) > hull(close,15)[1] at end of the Up run. not for every minute. I have used the following logic and getting the bubble in every candle. Please help.
plot Hull15 = HullMovingAvg(Close, 15);
def cntL = if Hull15 <= Hull15[1] then cntL[1] + 1 else cntL[1]; ########## to find the Begining of the Hull15 downtrend.
def cnt = if cntL == 1 and Hull15[1] > Hull15[2] then cnt[1] + 1 else cnt[1]; ######## If Downtrend has started check the previous candles till the Up trend is false.
addchartbubble(cnt > 0 , max(open,close) * 1.0005,cnt + " " + cntl,color.Yellow);
plot Hull15 = HullMovingAvg(Close, 15);
def cntL = if Hull15 <= Hull15[1] then cntL[1] + 1 else cntL[1]; ########## to find the Begining of the Hull15 downtrend.
def cnt = if cntL == 1 and Hull15[1] > Hull15[2] then cnt[1] + 1 else cnt[1]; ######## If Downtrend has started check the previous candles till the Up trend is false.
addchartbubble(cnt > 0 , max(open,close) * 1.0005,cnt + " " + cntl,color.Yellow);