Prior period levels

prior_levelslevelsForge API 1

The previous day, week or month open, high, low and close (PDH, PDL), carried forward.

Inputs

NameTypeDefault
periodchoiceD
day_boundarytext17:00 America/New_York

Outputs

NameTypeRequiredDescription
prev_openvalueOptionalcolor theme.neutral, dash dot, style step, width 1
prev_highvalueOptionalcolor theme.down, style step, width 1
prev_lowvalueOptionalcolor theme.up, style step, width 1
prev_closevalueOptionalcolor theme.neutral, dash dash, style step, width 1
Warm-up
0 bars (0 at the defaults)
Repaints
No
Parity
None

Formula

A trading day starts at day_boundary. With period D each trading day is one period; with W a week starts on the first trading day of its ISO week (Monday); with M a month starts on its first trading day.

prev_open, prev_high, prev_low and prev_close are the first open, the highest high, the lowest low and the last close of the previous period.

A value appears on the first bar of a period and stays for the whole period, so it is known before that bar closes. A period already under way at the first bar of the data is not used. A period holding a missing bar has no levels.