> For the complete documentation index, see [llms.txt](https://fto-2.gitbook.io/fto-indicators-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fto-2.gitbook.io/fto-indicators-docs/configure_indicator/get-buffer-count.md).

# GetBufferCount

Returns the number of values stored in a buffer.

## Syntax

```typescript
GetBufferCount(buffer: number): number
```

## Parameters

* `buffer` - A number representing the buffer index.

## Return Value

Returns a `number` representing the count of values stored in the specified buffer.

## Description

The `GetBufferCount` method returns the number of values that have been stored in a specific buffer. This can be useful for determining how many bars have valid indicator values.

## Example

```typescript
// Get the count of values in buffer 0
const count = this.api.GetBufferCount(0);

// Use the count to iterate through all values in the buffer
for (let i = 0; i < count; i++) {
  const value = this.someBuffer.getValue(i);
  // Process the value
}

// Check if there are enough values for calculations
if (this.api.GetBufferCount(0) >= period) {
  // Perform calculations that require at least 'period' values
}
```
