iBarShift

Returns the bar index for a specified time in the symbol's price history.

Syntax

iBarShift(symbol: string, timeframe: number, time: FTODate, exact: boolean): number

Parameters

  • symbol: The symbol to get data for

  • timeframe: The timeframe of the data (in minutes)

  • time: FTODate The time to search for

  • exact: Whether to require an exact match

Return Value

Returns a number representing the index of the bar corresponding to the specified time. Returns -1 if no matching bar is found.

Description

The iBarShift method searches for a bar with a specific opening time and returns its index. If exact is true, only bars with exactly matching times will be considered. If exact is false, the method will return the index of the nearest bar that opened before the specified time.

Example

Last updated