---
id: "M:cAlgo.API.OptimizationDateOnlyParameter.#ctor(System.String,System.DateOnly,System.DateOnly,System.TimeSpan)"
kind: "constructor"
type: "T:cAlgo.API.OptimizationDateOnlyParameter"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateOnlyParameter/Constructor/"
---

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

# OptimizationDateOnlyParameter constructor

Member of [OptimizationDateOnlyParameter](https://help.ctrader.com/ctrader-algo/references/Plugin/Optimization/OptimizationDateOnlyParameter/index.md).

## OptimizationDateOnlyParameter(string name, DateOnly min, DateOnly max, TimeSpan step)

Optimizes the parameter over the range the minimum to the maximum by the step.

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.

C#:

```csharp
public OptimizationDateOnlyParameter(string name, DateOnly min, DateOnly max, TimeSpan step)
```

Python:

```python
OptimizationDateOnlyParameter(name: str, min: DateOnly, max: DateOnly, step: TimeSpan)
```

### Parameters

- `name` (`string`, Python `str`): The cBot parameter name.
- `min` (`DateOnly`, Python `DateOnly`): The inclusive minimum of the range.
- `max` (`DateOnly`, Python `DateOnly`): The inclusive maximum of the range.
- `step` (`TimeSpan`, Python `TimeSpan`): The step of the range, as a time span.

Available since cAlgo.API 5.9.

### Examples

C#:

```csharp
var parameter = new OptimizationDateOnlyParameter("TradingStartDate", new DateOnly(2025, 1, 1), new DateOnly(2025, 3, 1), TimeSpan.FromDays(14));
Print("{0} is optimized: {1}", parameter.Name, parameter.IsOptimized);
```

Python:

```python
from System import DateOnly, TimeSpan
parameter = OptimizationDateOnlyParameter("TradingStartDate", DateOnly(2025, 1, 1), DateOnly(2025, 3, 1), TimeSpan.FromDays(14))
api.Print(f"{parameter.Name} is optimized: {parameter.IsOptimized}")
```

## OptimizationDateOnlyParameter(string name, DateOnly value)

Holds the parameter fixed at the given value.

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.

C#:

```csharp
public OptimizationDateOnlyParameter(string name, DateOnly value)
```

Python:

```python
OptimizationDateOnlyParameter(name: str, value: DateOnly)
```

### Parameters

- `name` (`string`, Python `str`): The cBot parameter name.
- `value` (`DateOnly`, Python `DateOnly`): The fixed value.

Available since cAlgo.API 5.9.

### Examples

C#:

```csharp
var parameter = new OptimizationDateOnlyParameter("TradingStartDate", new DateOnly(2025, 2, 3));
Print("{0} is fixed at {1}", parameter.Name, parameter.Value);
```

Python:

```python
from System import DateOnly
parameter = OptimizationDateOnlyParameter("TradingStartDate", DateOnly(2025, 2, 3))
api.Print(f"{parameter.Name} is fixed at {parameter.Value}")
```

## OptimizationDateOnlyParameter(OptimizationDateOnlyParameter original)



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.

C#:

```csharp
public OptimizationDateOnlyParameter(OptimizationDateOnlyParameter original)
```

Python:

```python
OptimizationDateOnlyParameter(original: OptimizationDateOnlyParameter)
```

### Parameters

- `original` (`OptimizationDateOnlyParameter`, Python `OptimizationDateOnlyParameter`):

Available since cAlgo.API 5.9.

