Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

dayofmonth - Pine Script Variable

The day number of the month, in the exchange time zone, calculated from the bar’s opening UNIX timestamp.

int

series

  • The value is based on the bar’s open. Overnight sessions may return the previous calendar day on the first session bar.
  • Combine with time_tradingday to align bars to the trading day rather than the calendar timestamp.
  • Use numeric comparisons (dayofmonth == 1) to detect monthly session boundaries.
//@version=6
indicator("Month boundary highlight", overlay=true)
isFirstDay = dayofmonth != dayofmonth[1]
bgcolor(isFirstDay ? color.new(color.purple, 82) : na,
title="First day of month")
plotshape(isFirstDay, style=shape.labeldown, text=str.tostring(dayofmonth),
color=color.new(color.purple, 0), textcolor=color.white)