How to look bask HH of red candle prior to the Green candle

If the previous bar is Green look for the HH of Red candle
And plot a horizontal line
and LL of of the Green Prior to the red candles
And plot a horizontal line

I want to see my stoploss line with value

Please Help HHLL

one important note wanted to look after the first candle of the day