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

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

# MarketSessionChangedEventArgs (class)

The arguments for MarketSessionsChanged event.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public class MarketSessionChangedEventArgs
```

## Examples

C#:

```csharp
protected override void OnStart()
{
    MarketSessionsChanged += OnMarketSessionsChanged;
}

private void OnMarketSessionsChanged(MarketSessionChangedEventArgs args)
{
    Print("Market sessions changed from {0} to {1}", args.PreviousSessions, args.NewSessions);
}
```

Python:

```python
def on_start(self):
    api.MarketSessionsChanged += self.on_market_sessions_changed

def on_market_sessions_changed(self, args):
    api.Print(f"Market sessions changed from {args.PreviousSessions} to {args.NewSessions}")
```

## Properties

- `public MarketSession NewSessions {get;}` — All current sessions including any new sessions that have just begun. The value of NewSessions is always equal to the value of the MarketSessions property of a cBot / indicator. Returns MarketSession.None if no new sessions started when the MarketSessionsChanged event was triggered. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/MarketSessionChangedEventArgs/NewSessions/index.md)
- `public MarketSession PreviousSessions {get;}` — Returns the previous value of the MarketSessions property before the MarketSessionsChanged event was triggered. Returns MarketSession.None if no previous sessions ended when the event was triggered. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/MarketSessionChangedEventArgs/PreviousSessions/index.md)

