For fun, I decided to implement this using the abovementioned module. I split it into two tags for readability but there's nothing stopping you from nesting the expressions into a single monstrosity:
Tag 1, getting the highest tag value of our group (assuming the tags are nicely ordered and 1-indexed):
max(
forEach(
tags(
forEach(24, stringFormat("[default]path/to/tag_%d", idx()+1))
),
it()[1]
)
)
Tag 2, getting the max of Tag 1 over time (see Tag Max Value no SQL - #2 by pturmel)
objectscript("args[0] if state.get('max') is None or args[0]>state.get('max') else state.get('max')\nstate['max']=__retv",
{[~]Tag_1})[0]