---
id: "M:cAlgo.API.SaveFileDialog.#ctor"
kind: "constructor"
type: "T:cAlgo.API.SaveFileDialog"
url: "https://help.ctrader.com/ctrader-algo/references/Dialogs/SaveFileDialog/Constructor/"
---

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

# SaveFileDialog constructor

Member of [SaveFileDialog](https://help.ctrader.com/ctrader-algo/references/Dialogs/SaveFileDialog/index.md).

## SaveFileDialog()

Creates a SaveFileDialog.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: No dialog can be shown in the CLI: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.
- Cloud: No dialog can be shown in the cloud: ShowDialog returns FileDialogResult.None, nothing is written and the dialog settings are only stored.

C#:

```csharp
public SaveFileDialog()
```

Python:

```python
SaveFileDialog()
```

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
var saveFileDialog = new SaveFileDialog { Title = "Export positions", Filter = "CSV files (*.csv)|*.csv", DefaultExt = "csv" };
if (saveFileDialog.ShowDialog() == FileDialogResult.OK)
    saveFileDialog.WriteToFile(string.Join(Environment.NewLine, Positions.Select(position => position.SymbolName + "," + position.NetProfit)));
```

Python:

```python
saveFileDialog = SaveFileDialog()
saveFileDialog.Title = "Export positions"
saveFileDialog.Filter = "CSV files (*.csv)|*.csv"
saveFileDialog.DefaultExt = "csv"
if saveFileDialog.ShowDialog() == FileDialogResult.OK:
    saveFileDialog.WriteToFile("\n".join(f"{p.SymbolName},{p.NetProfit}" for p in api.Positions))
```

