# RemoveAllObjects

Removes all chart objects of a specified type.

## Syntax

```typescript
RemoveAllObjects(objType: TObjectType, isStatic?: boolean, window?: number): void
```

## Parameters

| Parameter | Type                                                                          | Description                                                                     |
| --------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| objType   | [TObjectType](https://fto-2.gitbook.io/fto-indicators-docs/types/object-type) | The type of objects to remove                                                   |
| isStatic  | boolean                                                                       | Optional. Whether to remove static objects (default: false)                     |
| window    | number                                                                        | Optional. Target window: `0` = MainChart, `1+` = OscWin. Default: current chart |

## Description

The `RemoveAllObjects` method removes all chart objects of a specified type from the chart. This is useful for cleaning up multiple objects at once. The method can remove either regular objects or static objects, depending on the `isStatic` parameter. Use the optional `window` parameter to scope removal to a specific chart window.

## Example

```typescript
// Remove all trend lines
this.api.RemoveAllObjects(TObjectType.TREND_LINE);

// Remove all static text labels
this.api.RemoveAllObjects(TObjectType.TEXT, true);

// Clean up all drawing objects
const objectTypes = [
  TObjectType.TREND_LINE,
  TObjectType.RECTANGLE,
  TObjectType.TRIANGLE,
  TObjectType.TEXT,
];

for (const type of objectTypes) {
  this.api.RemoveAllObjects(type);
}

// Remove objects and log count
const beforeCount = this.api.GetObjectCount();
this.api.RemoveAllObjects(TObjectType.RECTANGLE);
const afterCount = this.api.GetObjectCount();
console.log(`Removed ${beforeCount - afterCount} rectangle objects`);
```
