nsm51
2
You want to count Higher Highs from the source array(cutoff) in this code.
The closest might be this, a relatively new function though over a year ago.
AFL Function Reference - BARSSINCECOMPARE (amibroker.com)
countClosedWithinTopRange = BarsSinceCompare( H, ">", cutoffPriceNearTop );
discussed here