How to check the Candle is red or green in macd histogram?

I actually want to fetch 3 red histogram bars consecutively. So how can I code this?

@Streak can you.

MACD histogram will show a green bar when the current histogram is higher than the previous histogram and similarly if the current histogram is lower than the previous histogram then it’s a red bar.

I have created a scanner based on your requirement to fetch 3 consecutively red histogram bars. Click on the below link to access it: