BarsSinceCompare returns "Empty" values for all bars which are higher that the Highest bar since Bar 1
Am I using it correctly?
Do I need to intrude an additional check for this condition?
dt = DateTime();
dn = DateNum();
newday = dn != Ref( dn, -1);
bars_of_today = BarsSince(newday) + 1;
tBarsSinceH = BarsSinceCompare( Close, ">", Close );
// check if the current array is not the highest value in the remaining data then use BarsSince Compare , if the current array is the highest then use current array
tBarsSinceH_close = IIf ( C < HHV( C , bars_of_today ), tBarsSinceH , BarsSince(HHV( C , bars_of_today )) ) ;
// or
tBarsSinceH_close = IIf ( C < HHV( C , bars_of_today ), tBarsSinceH , 0 ) ;