Since you are asking for a chart study solution, I have moved this question out of the "Alerts and Notifications" topic and into the "Chart Studies" topic.
We have received many requests for solutions based on Heikin-Ashi charts. So for this solution I have tried to anticipate all of the various other ways that folks may want to configure this. I have provided three user inputs which can be used to change the behavior. I included three screenshots below showing how these settings impact the behavior. The default settings are intended to match the details of your own request.
input topWick = yes;
input bottomWick = yes;
input direction = {default Both, Up, Down};
def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
def haUp = haClose > haOpen;
def haDown = haClose < haOpen; def filterDirection = if direction == direction.Both then yes else if direction == direction.Up then haUp else haDown; def filterTopWick = if topWick then haHigh > haOpen and haHigh > haOpen else (haUp and haHigh == haClose) or (haDown and haHigh == haOpen);
def filterBottomWick = if bottomWick then haLow < haOpen and haLow < haClose else (haUp and haLow == haOpen) or (haDown and haLow == haClose);
plot signalTop = filterDirection and filterTopWick and filterBottomWick;
signalTop.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
signalTop.AssignValueColor(if haUp then Color.GREEN else Color.RED);
signalTop.SetLineWeight(3);
plot signalBottom = filterDirection and filterTopWick and filterBottomWick;
signalBottom.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
signalBottom.AssignValueColor(if haUp then Color.GREEN else Color.RED);
signalBottom.SetLineWeight(3);
Alert(signalTop[1], "HA Wick Pattern", Alert.BAR, Sound.RING);