MACD Histogram : Max/min of 13 bars

I need to find the max of MACD Histogram bars when they are above 0 and min of the histogram bars when they are below zero for the last 13 bars. I need to code it into the scanner. Any advice is appreciated!

cc: @AlgoGeek :slight_smile:

MACD Histogram is not defined or not available in tradescript,

I agree.
I am able to find the value of a single MACD Histogram bar by calculating the difference between the MACD Line and the Signal line.
So I would like to explore the option of using a for/if loops for finding the max of the aforementioned range. But I have not been able to crack it yet, so looking forward to your expertise!