> 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/set-buffer-value.md).

# Set buffer value

Sets a value in a specific buffer at a given index.

## Syntax

```typescript
this.bufferName.setValue(index, value);
```

## Parameters

* `index` - A number representing the position in the buffer to set the value at.
* `value` - A number representing the value to store.

## Return Value

This method does not return a value.

## Description

The `setValue` method of a buffer object sets a value in a specific buffer at a given index. This is used to store calculated indicator values in the buffer for display on the chart.

## Example

```typescript
// Calculate a simple moving average
let sum = 0;
for (let i = 0; i < period; i++) {
  sum += this.api.Close(i);
}
const average = sum / period;

// Store the calculated value in buffer 0 at the current bar
this.someBuffer.setValue(0, average);

// Store values for multiple bars
for (let i = 0; i < this.api.Bars(); i++) {
  const value = calculateIndicatorValue(i);
  this.someBuffer.setValue(i, value);
}
```
