---
id: "M:cAlgo.API.Internals.MarketHours.TimeTillClose"
kind: "method"
type: "T:cAlgo.API.Internals.MarketHours"
url: "https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/MarketHours/TimeTillClose/"
---

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

# MarketHours.TimeTillClose

Member of [MarketHours](https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/MarketHours/index.md).

## TimeTillClose()

Time left till end of current trading session. Returns 0 if session is not active

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
TimeSpan TimeTillClose()
```

Python:

```python
marketHours.TimeTillClose() -> TimeSpan
```

### Returns

`TimeSpan` — 

### Examples

C#:

```csharp
var timeTillClose = Symbol.MarketHours.TimeTillClose();
if (timeTillClose > TimeSpan.Zero && timeTillClose < TimeSpan.FromMinutes(5))
    Print("Session closes in {0}", timeTillClose);
```

Python:

```python
from System import TimeSpan
timeTillClose = api.Symbol.MarketHours.TimeTillClose()
if timeTillClose > TimeSpan.Zero and timeTillClose < TimeSpan.FromMinutes(5):
    api.Print(f"Session closes in {timeTillClose}")
```

