---
id: "T:cAlgo.API.OptimizationDateTimeParameter"
kind: "record"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/"
---

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

# OptimizationDateTimeParameter (record)

A `DateTime` cBot parameter, optimized over a date-time range or held fixed.

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 OptimizationDateTimeParameter : OptimizationParameter`1
```

Available since cAlgo.API 5.9.

## Examples

C#:

```csharp
var parameter = new OptimizationDateTimeParameter("SessionStart", new DateTime(2025, 1, 1, 6, 0, 0), new DateTime(2025, 1, 1, 12, 0, 0), TimeSpan.FromHours(1));
Print("{0}: {1} to {2} by {3}", parameter.Name, parameter.Min, parameter.Max, parameter.Step);
```

Python:

```python
from System import DateTime, TimeSpan
parameter = OptimizationDateTimeParameter("SessionStart", DateTime(2025, 1, 1, 6, 0, 0), DateTime(2025, 1, 1, 12, 0, 0), TimeSpan.FromHours(1))
api.Print(f"{parameter.Name}: {parameter.Min} to {parameter.Max} by {parameter.Step}")
```

## Constructors

- `public OptimizationDateTimeParameter(string name, DateTime min, DateTime max, TimeSpan step)` — Optimizes the parameter over the range the minimum to the maximum by the step. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Constructor/index.md)
- `public OptimizationDateTimeParameter(string name, DateTime value)` — Holds the parameter fixed at the given value. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Constructor/index.md)
- `public OptimizationDateTimeParameter(OptimizationDateTimeParameter original)` —  [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Constructor/index.md)

## Properties

- `public DateTime Max {get;}` — Gets the inclusive maximum of the range. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Max/index.md)
- `public DateTime Min {get;}` — Gets the inclusive minimum of the range. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Min/index.md)
- `public TimeSpan Step {get;}` — Gets the step of the range, as a time span. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateTimeParameter/Step/index.md)

## Inherited members

- `public string Name {get;}` (from OptimizationParameter) [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationParameter/Name/index.md)
- `public bool IsOptimized {get;}` (from OptimizationParameter) [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationParameter/IsOptimized/index.md)

