---
id: "T:cAlgo.API.TimeFrames"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Period/TimeFrames/"
---

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

# TimeFrames (interface)

Represents collection of all time frames including custom time frames.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: Lists only the standard built-in time frames, no custom ones. Added and Removed are never raised.
- Cloud: Lists only the standard built-in time frames, no custom ones. Added and Removed are never raised.

## Definition

```csharp
public interface TimeFrames
```

Available since cAlgo.API 5.3.

## Examples

C#:

```csharp
using cAlgo.API;
using System.Linq;

namespace cAlgo.Robots;

public partial class Test : Robot
{
    protected override void OnStart()
    {
        Print($"TimeFrames Count: {TimeFrames.Count()}");

        foreach (var timeFrame in TimeFrames)
        {
            Print($"Name: {timeFrame.Name}, ShortName: {timeFrame.ShortName}");
        }

        TimeFrames.Added += args => Print($"TimeFrames added: {string.Join(", ", args.TimeFrames.Select(timeFrame => timeFrame.Name))}");
        TimeFrames.Removed += args => Print($"TimeFrames removed: {string.Join(", ", args.TimeFrames.Select(timeFrame => timeFrame.Name))}");
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def on_start(self):
        print(f"TimeFrames Count: {len(list(api.TimeFrames))}")

        for timeFrame in api.TimeFrames:
            print(f"Name: {timeFrame.Name}, ShortName: {timeFrame.ShortName}")

        api.TimeFrames.Added += lambda args: print("TimeFrames added: " + ", ".join([tf.Name for tf in args.TimeFrames]))
        api.TimeFrames.Removed += lambda args: print("TimeFrames removed: " + ", ".join([tf.Name for tf in args.TimeFrames]))
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## Events

- `event Action<TimeFramesAddedEventArgs> Added;` — Occurs when new TimeFrames are added. [details](https://help.ctrader.com/ctrader-algo/references/Period/TimeFrames/Added/index.md)
- `event Action<TimeFramesRemovedEventArgs> Removed;` — Occurs when TimeFrames are removed. [details](https://help.ctrader.com/ctrader-algo/references/Period/TimeFrames/Removed/index.md)

