Sidechair

dayofmonth

Browse the reference

The day of the month of the current bar's open time, from 1 to 31.

Try it in the editor

dayofmonth is a series int giving the calendar day in the exchange time zone. It resets to 1 at the start of each month.

Type

series int

Remarks

  • dayofmonth[n] is na before the first bar.
  • On Sidechair: the parts are read in the symbol's exchange time zone, the same as syminfo.timezone.
  • Months differ in length, so a test such as dayofmonth == 31 skips some months. Compare month != month[1] to find the first bar of every month.

Example

Pine ScriptFirst days of the monthOpen in editor
//@version=6
indicator("Start of month", overlay = true)
bgcolor(dayofmonth <= 3 ? color.new(color.green, 90) : na)
plot(dayofmonth, "Day", display = display.data_window)

See also

Runs on Sidechair