# 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
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fto-2.gitbook.io/fto-indicators-docs/configure_indicator/get-buffer-count.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
