# OnHide

### What is it?

The `OnHide` method is called **automatically** when the indicator is **hidden** from the chart — for example, when the user disables its visibility.

This gives you a place to clean up any visual elements or perform other logic when the indicator is no longer visible.

***

### Syntax

```ts
public OnHide(): void {
    // logic after hiding the indicator
}
```

***

### When and Why to Use It

Use `OnHide` when you want to:

* **Remove custom chart objects** (labels, lines, shapes) added by the indicator
* **Free resources** or stop background logic tied to visualization
* Prepare for a clean re-render when the indicator is shown again

***

### Example

```ts
public OnHide(): void {
    // Custom method to remove a label created when the indicator was shown
    this.DeleteObject("InfoLabel")
}
```

***

### Important Notes

* `OnHide` only runs when the indicator becomes hidden — not when it is removed completely.
* It pairs naturally with `OnShow`, helping you manage custom visual elements.
