FlowscopeDocs

T408

indicator on a calendar timeframe

Severity Error

A ta.* indicator receives a series from a subscription on a calendar timeframe (1M). Months have different lengths, so period-based indicators would weigh them inconsistently.

Run the indicator on a fixed-length timeframe (seconds to weeks), or read the monthly values directly without an indicator.

Failing example

Flowscope Script
script "Monthly EMA"
data monthly = subscribe(data.ohlcv, timeframe: 1M)
plot ema = plot.line(title: "Monthly EMA 12", style: linestyle.step)
on monthly.close {
  ema.plot(ta.ema(monthly.close, 12))
}

Fixed example

Flowscope Script
script "Monthly EMA"
data weekly = subscribe(data.ohlcv, timeframe: 1W)
plot ema = plot.line(title: "Weekly EMA 52", style: linestyle.step)
on weekly.close {
  ema.plot(ta.ema(weekly.close, 52))
}