SetIndexBuffer
Assigns a buffer to a specific index.
Syntax
SetIndexBuffer(bufferIndex: number, buffer: TIndexBuffer): void
Parameters
bufferIndex
- A number representing the index to assign the buffer to.buffer
- A TIndexBuffer object to be assigned to the specified index.
Return Value
This method does not return a value.
Description
The SetIndexBuffer
method assigns a buffer to a specific index. This is necessary after creating a buffer with CreateIndexBuffer to specify which index the buffer should be associated with. The index must be less than the number of buffers specified with IndicatorBuffers.
Example
// Specify that the indicator uses 3 buffers
this.api.IndicatorBuffers(3);
// Create buffers
const upperBuffer = this.api.CreateIndexBuffer();
const middleBuffer = this.api.CreateIndexBuffer();
const lowerBuffer = this.api.CreateIndexBuffer();
// Assign buffers to indices
this.api.SetIndexBuffer(0, upperBuffer);
this.api.SetIndexBuffer(1, middleBuffer);
this.api.SetIndexBuffer(2, lowerBuffer);
// Now the buffers can be used to store indicator values
Last updated