Daily high/low reversal EA needed

Can someone help me to code an EA with the following rules:

1) price within 20 pips of the daily high/low - that is OPPORTUNITY
2) up/down candle closes
3) up/down candle closes - note the high price of the up/down candle
4) enter long at the up/down candle's high/low price
5) SL and TP options are also needed

E.g. Taking a short position

1)Price makes a new daily high
2)The up candle closes
3)The down candle closes
4)Enter short at the low of the down candle

E.g. Taking a long position

1)Price makes a new daily low
2)The down candle closes
3)The up candle closes
4)Enter long at the high of the up candle