FindBar (Function)

image\trumpet2.gif Disclaimer

The FindBar function searches back in time for the first bar matching the date and time specified through the inputs TargetDate and TargetTime.

Syntax

FindBar(TargetDate, TargetTime)

Returns (Integer)

The number of bars ago on which the target time and date occurs.

Parameters

Name

Type

Description

TargetDate

Numeric

Sets the date of the bar to find, entered in YYYMMDD format.  Enter 1060115 for Jan. 15, 2006.

TargetTime

Numeric

Sets the time of the bar to find, entered in 24-hour military format.  Enter 1300 for 1:00pm.

Remarks

It searches back through the full range of bars specified in the Maximum number of bars referenced by a study setting (known as MaxBarsBack). By default, FindBar requests 50 bars of data. If additional bars are needed to perform a calculation, the MaxBarsBack setting must be increased manually.  If the target bar time and date cannot be found, the function returns a -1 (for example if the bar time hasn't yet occurred).

Example

Sets Value1 to the number of bars ago that the bar with the date of 5/10/2005 and time of 10:30am occurred.

Value1 = FindBar(1050510, 1030);