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

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

# BacktestingDataRequestStatusChangedEventArgs (class)

Provides data for the backtesting data request status 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 BacktestingDataRequestStatusChangedEventArgs
```

Available since cAlgo.API 5.3.

## Examples

C#:

```csharp
protected override void OnStart()
{
    var options = new BacktestingDataSourceOptions(BacktestingDataSourceDataType.M1OpenPrices, OnMinMaxTimeRequested, OnDataRequested);
    Backtesting.DataSources.Add("My Data Source", options);
}

private BacktestingMinMaxTime OnMinMaxTimeRequested(BacktestingDataSourceMinMaxTimeArgs args)
{
    return new BacktestingMinMaxTime(Server.Time.AddYears(-1), Server.Time);
}

private void OnDataRequested(BacktestingDataRequest request)
{
    request.StatusChanged += OnDataRequestStatusChanged;
    request.Fail("No data available for the requested period");
}

private void OnDataRequestStatusChanged(BacktestingDataRequestStatusChangedEventArgs args)
{
    Print("Data request {0} status changed to {1}", args.DataRequest.PriceDataSourceId, args.DataRequest.Status);
}
```

Python:

```python
from System import Action, Func

def on_start(self):
    options = BacktestingDataSourceOptions(BacktestingDataSourceDataType.M1OpenPrices, Func[BacktestingDataSourceMinMaxTimeArgs, BacktestingMinMaxTime](self.on_min_max_time_requested), Action[BacktestingDataRequest](self.on_data_requested))
    api.Backtesting.DataSources.Add("My Data Source", options)

def on_min_max_time_requested(self, args):
    return BacktestingMinMaxTime(api.Server.Time.AddYears(-1), api.Server.Time)

def on_data_requested(self, request):
    request.StatusChanged += self.on_data_request_status_changed
    request.Fail("No data available for the requested period")

def on_data_request_status_changed(self, args):
    api.Print(f"Data request {args.DataRequest.PriceDataSourceId} status changed to {args.DataRequest.Status}")
```

## Properties

- `public BacktestingDataRequest DataRequest {get;}` — Gets data request. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/BacktestingDataRequestStatusChangedEventArgs/DataRequest/index.md)

