---
id: "M:cAlgo.API.LocalStorage.Remove(System.String)"
kind: "method"
type: "T:cAlgo.API.LocalStorage"
url: "https://help.ctrader.com/ctrader-algo/references/Localstorage/LocalStorage/Remove/"
---

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

# LocalStorage.Remove

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

## Remove(string key)

Removes an element from local storage. This method will search all available scopes (Instance -&gt; Type -&gt; Device) and stops on first found value.

Environments: Desktop supported · CLI supported · Cloud works differently.

- Cloud: Values are kept in memory for the current run only; nothing is saved to or read from disk, and auto-flush is off.

C#:

```csharp
void Remove(string key)
```

Python:

```python
api.LocalStorage.Remove(key: str) -> None
```

### Parameters

- `key` (`string`, Python `str`): The key of the element to remove, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end

### Examples

C#:

```csharp
LocalStorage.SetString("Last Signal", "Buy EURUSD");
LocalStorage.Remove("Last Signal");
Print("After remove: '{0}'", LocalStorage.GetString("Last Signal"));
```

Python:

```python
api.LocalStorage.SetString("Last Signal", "Buy EURUSD")
api.LocalStorage.Remove("Last Signal")
api.Print(f"After remove: '{api.LocalStorage.GetString('Last Signal')}'")
```

## Remove(string key, LocalStorageScope localStorageScope)

Removes an element from local storage.

Environments: Desktop supported · CLI supported · Cloud works differently.

- Cloud: Values are kept in memory for the current run only; nothing is saved to or read from disk, and auto-flush is off.

C#:

```csharp
void Remove(string key, LocalStorageScope localStorageScope)
```

Python:

```python
api.LocalStorage.Remove(key: str, localStorageScope: LocalStorageScope) -> None
```

### Parameters

- `key` (`string`, Python `str`): The key of the element to remove, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
- `localStorageScope` (`LocalStorageScope`, Python `LocalStorageScope`): The storage scope of the element

### Examples

C#:

```csharp
LocalStorage.SetString("Last Signal", "Buy EURUSD", LocalStorageScope.Device);
LocalStorage.Remove("Last Signal", LocalStorageScope.Device);
Print("After remove: '{0}'", LocalStorage.GetString("Last Signal", LocalStorageScope.Device));
```

Python:

```python
api.LocalStorage.SetString("Last Signal", "Buy EURUSD", LocalStorageScope.Device)
api.LocalStorage.Remove("Last Signal", LocalStorageScope.Device)
api.Print(f"After remove: '{api.LocalStorage.GetString('Last Signal', LocalStorageScope.Device)}'")
```

