Skip to content

LocalStorage.Remove

method · LocalStorage · cAlgo.API

DesktopCLICloud

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

Environment behaviour

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

Overloads

Signature Description
Remove(string key) Removes an element from local storage. This method will search all available scopes (Instance -> Type -> Device) and stops on first found value.
Remove(string key, LocalStorageScope localStorageScope) Removes an element from local storage.

Remove(string key)

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

void Remove(string key)
api.LocalStorage.Remove(key: str) -> None

Parameters

Name C# type Python type Description
key string 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

LocalStorage.SetString("Last Signal", "Buy EURUSD");
LocalStorage.Remove("Last Signal");
Print("After remove: '{0}'", LocalStorage.GetString("Last Signal"));
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.

void Remove(string key, LocalStorageScope localStorageScope)
api.LocalStorage.Remove(key: str, localStorageScope: LocalStorageScope) -> None

Parameters

Name C# type Python type Description
key string 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 LocalStorageScope The storage scope of the element

Examples

LocalStorage.SetString("Last Signal", "Buy EURUSD", LocalStorageScope.Device);
LocalStorage.Remove("Last Signal", LocalStorageScope.Device);
Print("After remove: '{0}'", LocalStorage.GetString("Last Signal", LocalStorageScope.Device));
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)}'")