GetBufferMin
Syntax
GetBufferMin(buffer: number, index1: number, index2: number): numberParameters
Return Value
Description
Example
Last updated
GetBufferMin(buffer: number, index1: number, index2: number): numberLast updated
// Create buffer
public someBuffer = this.api.CreateIndexBuffer();
// Assign the buffer to index 0
this.api.SetIndexBuffer(0, this.someBuffer)
// Find the minimum value in buffer 0 over the last 20 bars
const min = this.api.GetBufferMin(0, 0, 19)
// Find the minimum value in buffer 1 over a custom range
const startIndex = 10
const endIndex = 50
const minInRange = this.api.GetBufferMin(1, startIndex, endIndex)
// Use the minimum value for normalization
const range = this.api.GetBufferMax(0, 0, 19) - min
for (let i = 0; i < 20; i++) {
const normalizedValue = (this.someBuffer.getValue(i) - min) / range
this.someBuffer.setValue(i, normalizedValue)
}