---
id: "M:cAlgo.API.ChartFrame.TryChangeTimeFrame(cAlgo.API.TimeFrame)"
kind: "method"
type: "T:cAlgo.API.ChartFrame"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Chart/ChartFrame/TryChangeTimeFrame/"
---

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

# ChartFrame.TryChangeTimeFrame

Member of [ChartFrame](https://help.ctrader.com/ctrader-algo/references/Plugin/Chart/ChartFrame/index.md).

## TryChangeTimeFrame(TimeFrame timeFrame)

Changes the time frame on the chart.

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 TryChangeTimeFrame(TimeFrame timeFrame)
```

Python:

```python
chartFrame.TryChangeTimeFrame(timeFrame: TimeFrame) -> bool
```

### Parameters

- `timeFrame` (`TimeFrame`, Python `TimeFrame`): The time frame to change the current chart time frame to

### Returns

`bool` — True if successful otherwise false.

### Examples

C#:

```csharp
var chartFrame = ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour);
var isChanged = chartFrame.TryChangeTimeFrame(TimeFrame.Daily);
Print("Time frame changed: {0}", isChanged);
```

Python:

```python
chartFrame = api.ChartManager.AddChartFrame("EURUSD", TimeFrame.Hour)
isChanged = chartFrame.TryChangeTimeFrame(TimeFrame.Daily)
api.Print(f"Time frame changed: {isChanged}")
```

