Displacement (position) in the array of the highest value for the specified number of bars, starting from the specified reference point (start)
Bar.highest(prices:Array, count:int=array.length, start:int)
Parameters
Name |
Type |
Действие |
Значение по умолчанию |
prices |
Array |
Array with prices |
— |
count |
int |
The number of bars (in the direction from the current bar in the direction of increasing the index), among which the search should be performed |
array.length |
start |
int |
A shift showing the bar relative to the current bar that the data should be taken from. |
— |
Return value
Displacement (position) in the array of the highest value for the specified number of bars, starting from the specified reference point
Example
export class Main extends Indicator {
constructor() {
super();
}
onInit() {
}
async onUpdate() {
const priceType = PriceType.Bid,
{Time, Open} = await Bar.load([Bar.Mode.Time, Bar.Mode.Open], priceType);
let period = 12, shift = 46;
// Find the largest value of the Open array in the range from Open [46] to Open [46 + 12-1] (12 array elements)
let HighestIndex = Bar.highest(Open, period, shift)
let MaxOfArrayPart = Open[HighestIndex];
this.print('Highest bar is at '+ HighestIndex + " and it's value is " +MaxOfArrayPart+'.');
}
}