LowestBar()

View as Markdown

Definition

Returns the number of bars ago the lowest price value occurred within the specified look-back period.

Method Return Value

An int value representing a value of bars ago.

Syntax

LowestBar(ISeries\<double\> series, int period)

Parameters

ParameterDescription
periodThe number of bars to check for the test condition
seriesAny Series<double> type object such as an indicator, Close, High, Low, etc…

Examples

1protected override void OnBarUpdate()
2{
3 // store the lowest bar ago value
4 int lowestBar = LowestBar(Low, Bars.BarsSinceNewTradingDay);
5
6 //evaluate low price from lowest bar ago value
7 double lowestPrice = Low[lowestBar];
8
9 //Printed result: Lowest price of the session: 2087.25 - occurred 362 bars ago
10 Print(string.Format("Lowest price of the session: {0} - occurred {1} bars ago", lowestPrice, lowestBar));
11}