---
id: "M:cAlgo.API.BacktestingDataSource.ClearCache"
kind: "method"
type: "T:cAlgo.API.BacktestingDataSource"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSource/ClearCache/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# BacktestingDataSource.ClearCache

Member of [BacktestingDataSource](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingDataSource/index.md).

## ClearCache()

Clears cached price data of current data source if not being used.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

C#:

```csharp
bool ClearCache()
```

Python:

```python
backtestingDataSource.ClearCache() -> bool
```

### Returns

`bool` — True if succeeded otherwise False.

Available since cAlgo.API 5.3.

### Examples

C#:

```csharp
foreach (var dataSource in Backtesting.DataSources)
    Print("Cache of {0} cleared: {1}", dataSource.Name, dataSource.ClearCache());
```

Python:

```python
for dataSource in api.Backtesting.DataSources:
    api.Print(f"Cache of {dataSource.Name} cleared: {dataSource.ClearCache()}")
```

