SetBufferShift

Sets the horizontal shift for a buffer.

Syntax

SetBufferShift(bufferIndex: number, shift: number): void

Parameters

  • bufferIndex - A number representing the index of the buffer.

  • shift - A number representing the number of bars to shift the buffer.

Return Value

This method does not return a value.

Description

The SetBufferShift method sets the horizontal shift for a buffer. This allows you to offset the display of the buffer by a specified number of bars. Positive values shift the buffer to the right (into the future), while negative values shift it to the left (into the past).

Example

// Shift buffer 0 forward by 5 bars (into the future)
this.api.SetBufferShift(0, 5)

// Shift buffer 1 backward by 3 bars (into the past)
this.api.SetBufferShift(1, -3)

// Use shifting to create a predictive indicator
const predictionPeriod = 10
this.api.SetBufferShift(0, predictionPeriod)

Last updated