Navigation: Realtest Script Language > Syntax Element Details >

DateBars

 

 

 

 

Category

Multi-Bar Functions

Description

Number of bars since (or until) a specific date

Syntax

DateBars(date)

Parameters

date - a numeric date

Notes

This function can be used to return a bar count or offset from the current bar to a specific date in the past or future.

The date parameter can be any formula returning a numeric date value.

The Date function is a convenient way to generate a numeric date.

If there is no bar with the specified date, the first bar with a date more recent than the specified date is used.

Examples

PctChg(C, DateBars(Date(2016,2,1))) returns the percent gain or loss since February 2, 2016.

C[DateBars(Date(Year,1,1)] returns the closing price for the first trading date of the current year.

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC