仅在时间范围小于 H4 时显示区域

Show zones only if timeframe is less than H4

我正在使用 FX Market Sessions 脚本,但我只想在当前时间范围低于 H4 时显示会话区域。我该怎么做?

bool show = timeframe.multiplier >= 1 and timeframe.multiplier <= 60

将时间范围转换为分钟,然后比较结果。

//@version=5
indicator("My script")

f_tfInMinutes() => 
    _tfInMinutes = timeframe.multiplier * (
      timeframe.isseconds ? 1. / 60             :
      timeframe.isminutes ? 1.                  :
      timeframe.isdaily   ? 60. * 24            :
      timeframe.isweekly  ? 60. * 24 * 7        :
      timeframe.ismonthly ? 60. * 24 * 30.4375  : na)

is_show = f_tfInMinutes() < 240

plot(is_show ? close : na)