# Done

### What is it?

The `Done` method is called **once**, after the indicator has finished calculating all bars.\
It marks the end of the calculation cycle and is typically used for **final steps or cleanup**.

***

### Syntax

```ts
public Done(): void {
    // logic after finishing the calculation
}
```

***

### When and Why to Use It

Use `Done` when you need to:

* Perform **post-processing** after all `Calculate()` calls are complete
* Draw or update **custom chart objects** that rely on full data
* Clean up temporary data or buffers
* Log or store final values

This method is especially useful if your indicator logic depends on seeing the **entire dataset**.

***

### Example

```ts
public Done(): void {
    // Draw a horizontal line based on final SMA value
    const lastIndex = 0
    const finalValue = this.SMA.getValue(lastIndex)
    
    // custom method CreateHorizontalLine
    this.api.CreateHorizontalLine("FinalSMA", finalValue, "red") 
}
```

***

### Important Notes

* `Done` is called **after all bars** have been processed in `Calculate()`.
* It runs **once** per full calculation cycle — not on every tick.
* It’s safe to use this method to add chart decorations, logs, or summary calculations.


---

# Agent Instructions: 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/indicators/indicator-structure/done.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.
