BarStatus (Reserved Word)

image\trumpet2.gif Disclaimer

This reserved word is used to determine whether the current tick is the opening or closing tick of a bar, or whether it is a tick ’inside the bar.’

BarStatus(DataN)

DataN is a expression representing the number of the data stream that is being evaluated. 1 refers to Data1, 2 to Data2 and so on. DataNum can be between 1 and 50, inclusive. 

Notes:

This reserved word will return one of four possible values:

2 = the closing tick of a bar
1 = a tick within a bar
0 = the opening tick of a bar (relevant only for strategies using Open Next Bar order actions)
-1 = an error occurred while executing the reserved word

When used with multi-data charts the data series referenced must be applied to the chart. For example, to use BarStatus (2), a second data series must be applied to the chart.

Example

To perform an operation at the closing tick on the last bar you could write:

if LastBarOnChart and BarStatus( 1 ) = 2 then

 {Your Operation Here} ;

or

To display the status of a bar for the current data stream you can use the 0-based DataNum +1:

print(BarStatus(DataNum + 1));