Skip to content
Algo Trade Analytics Docs

timeframe.change() - Pine Script Function

Detects changes in the specified timeframe.

timeframe.change(timeframe) → series bool
NameTypeDescription
timeframeseries stringString formatted according to the User manual’s timeframe string specifications.

Returns true on the first bar of a new timeframe, false otherwise.

//@version=6
// Run this script on an intraday chart.
indicator("New day started", overlay = true)// Highlights the first bar of the new day.isNewDay = timeframe.change("1D")
bgcolor(isNewDay ? color.new(color.green, 80) : na)