Sidechair

timeframe.multiplier

Browse the reference

The number in the chart's timeframe: 5 on a five-minute chart, 240 on a four-hour chart, 1 on a daily chart.

Try it in the editor

timeframe.multiplier is the count of the unit the chart uses. A 5-minute chart gives 5, a 15-second chart gives 15, a 3-day chart gives 3 and a weekly chart gives 1. An hour chart is counted in minutes, so a 4-hour chart gives 240.

Combine it with timeframe.isseconds, timeframe.isminutes, timeframe.isdaily, timeframe.isweekly and timeframe.ismonthly to recover both the number and the unit. For a single number of seconds, use timeframe.in_seconds().

Type

simple int

Remarks

  • It is a simple int: the same on every bar of the run.
  • On Sidechair: the value is the seconds on a seconds chart, the minutes on an intraday chart, the weeks on a weekly chart and the days otherwise. A monthly chart reports its length in days.

Example

Pine ScriptLength scaled to the timeframeOpen in editor
//@version=6
indicator("Scaled length", overlay = true)
len = timeframe.isminutes ? math.max(5, int(240 / timeframe.multiplier)) : 20
plot(close, "Close", color.gray)
plot(ta.sma(close, len), "SMA", color.blue, 2)

See also

Runs on Sidechair