getting total bars coded by FXshart
https://forum.amibroker.com/t/how-to-find-the-number-of-bars-in-a-given-day/11057/2?u=needhelp
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 ) ;
reference for reading
https://forum.amibroker.com/t/bars-since-higher-or-equal-value/4829/2?u=needhelp
https://forum.amibroker.com/t/duplicate-bars-since-price-was-this-high-low/28355/14
I hope it is help .