Argh... Timeframe references at H1 or higher in MQL5 are not the same as in MQL4. My previous fix in version 3 blew up the middle timeframes. My bad. Fixed in version 4 which organically calculates the current timeframe from seconds:
Re: Convert MT4 indicators to MT5
391“[A]s we know, there are known knowns—there are things we know we know. We also know there are known unknowns—that is to say we know there are some things we do not know. But there are also unknown unknowns—the ones we don’t know we don’t know.”—Donald Rumsfeld, 2002