---
id: "T:cAlgo.API.ActiveFrameChangedEventArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/ActiveFrameChangedEventArgs/"
---

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

# ActiveFrameChangedEventArgs (class)

Provides data for the active frame changed event.

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.

## Definition

```csharp
public class ActiveFrameChangedEventArgs
```

## Examples

C#:

```csharp
protected override void OnStart()
{
    ChartManager.ActiveFrameChanged += OnActiveFrameChanged;
}

private void OnActiveFrameChanged(ActiveFrameChangedEventArgs args)
{
    var oldFrameId = args.OldFrame?.Id ?? "none";
    var newFrameId = args.NewFrame?.Id ?? "none";
    Print("Active frame changed from {0} to {1}", oldFrameId, newFrameId);
}
```

Python:

```python
def on_start(self):
    api.ChartManager.ActiveFrameChanged += self.on_active_frame_changed

def on_active_frame_changed(self, args):
    old_frame_id = args.OldFrame.Id if args.OldFrame is not None else "none"
    new_frame_id = args.NewFrame.Id if args.NewFrame is not None else "none"
    api.Print(f"Active frame changed from {old_frame_id} to {new_frame_id}")
```

## Properties

- `public Frame NewFrame {get;}` — Returns the new active frame or null. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ActiveFrameChangedEventArgs/NewFrame/index.md)
- `public Frame OldFrame {get;}` — Returns the old / previous active frame or null. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ActiveFrameChangedEventArgs/OldFrame/index.md)

