HighestBar

Top  Previous  Next

Finds the highest value of the series, then return the bars back.

 

Syntax

 

HighestBar( series, bars, [offset] )

 

Parameters

series

 

the name of the series

bars

 

the number of bars over which to find the value

offset

 

the number of bars to offset before finding the value

 

 

 

returns

 

the number of bars back from the offset starting index to the highest value bar

 

Example

VARIABLES: highestCloseBar, highestHighBar, lowestLowBar TYPE: Price

 

' Find the highest close bar of the last 50 bars

highestCloseBar = HighestBar( instrument.close, 50 )

 

' Find the lowest low bar of the last 100 bars

lowestLowBar = LowestBar( instrument.low, 100 )

 

' Find the highest high bar since the entry of the first unit of the current position

IF instrument.position <> OUT THEN

 highestHighBar = HighestBar( instrument.high, instrument.unitBarsSinceEntry )

ENDIF

 

' Now print the close of the highest bar:

PRINT instrument.close[ highestHighBar ]

 

 

 

The return value is the number of bars back from the starting index. If no starting index is used, then it is the bars back from the current bar. If a starting index offset is used, then the return value is the bars back from that offset.

 

This example shows the use of the common auto indexed series. For information on using functions with non auto indexed series review Series Functions.