Date

Syntax

@Date

Description

Annotates an integer input as a date:

  • The date must be specified using the YYYYMMDD format.
  • Only integer inputs can be annotated as a date.
  • To annotate multiple inputs, specify annotations for each.

Change annotated date inputs by:

  1. Using the built-in date picker in the study properties.

  1. Right-clicking the chart area on a specific date.

Example 1

@Date
input date = 20240101;
AddVerticalLine(GetYYYYMMDD() >= date and GetYYYYMMDD()[1] < date);

This script draws a vertical line at the specified date.

Example 2

@Date
input beginDate = 20231106;
@Date
input endDate = 20231226;

plot Line = if GetYYYYMMDD() >= beginDate and GetYYYYMMDD()[1] < beginDate or GetYYYYMMDD() >= endDate and GetYYYYMMDD()[1] < endDate then close else Double.NaN;
Line.EnableApproximation();

This script draws a line between closing prices for beginDate and endDate.