Skip to content
Algo Trade Analytics Docs

month - Pine Script Variable

Current bar month in exchange timezone.

int

series

  • The value is derived from the bar’s opening time. Overnight sessions can report the prior month on the first bar.
  • Note that this variable returns the month based on the time of the bar’s open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the month of the trading day.
//@version=6
indicator("Monthly separators", overlay=true)
isNewMonth = ta.change(month)
bgcolor(isNewMonth ? color.new(color.purple, 85) : na)