---
id: "T:cAlgo.API.PriceAlerts"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/"
---

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

# PriceAlerts (interface)

Represents a collection of price alerts.

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

- Cloud: Always empty: Count 0, Find null, FindAll empty, Remove false. Added/Removed/Updated/Triggered never raised.

## Definition

```csharp
public interface PriceAlerts
```

Available since cAlgo.API 5.2.

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots;

public partial class Test : Robot
{
    protected override void OnStart()
    {
        Print($"Price Alerts Count: {PriceAlerts.Count}");

        foreach (var priceAlert in PriceAlerts)
        {
            Print($"Price Alert Id: {priceAlert.Id}, Symbol: {priceAlert.Symbol.Name}, Price: {priceAlert.Price}, Quote Type: {priceAlert.QuoteType}, Condition: {priceAlert.Condition}");
        }

        PriceAlerts.Added += args => Print($"Price Alert added: {args.PriceAlert.Id}");
        PriceAlerts.Removed += args => Print($"Price Alert removed: {args.PriceAlert.Id}");
        PriceAlerts.Updated += args => Print($"Price Alert updated: {args.PriceAlert.Id}");
        PriceAlerts.Triggered += args => Print($"Price Alert triggered: {args.PriceAlert.Id}");

        var newPriceAlert = PriceAlerts.Add(Symbol, Symbol.Bid + (100 * Symbol.PipSize), PriceAlertQuoteType.Bid, PriceAlertCondition.HigherOrEqual);

        newPriceAlert.Update(Symbol, newPriceAlert.Price, newPriceAlert.QuoteType, newPriceAlert.Condition, true, "Price alert message");

        Print($"Finding price alert result: {PriceAlerts.Find(newPriceAlert.Id) == newPriceAlert}");

        PriceAlerts.Remove(newPriceAlert);
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        print(f"Price Alerts Count: {api.PriceAlerts.Count}")

        for priceAlert in api.PriceAlerts:
            print(f"Price Alert Id: {priceAlert.Id}, Symbol: {priceAlert.Symbol.Name}, Price: {priceAlert.Price}, Quote Type: {priceAlert.QuoteType}, Condition: {priceAlert.Condition}")

        api.PriceAlerts.Added += lambda args: print(f"Price Alert added: {args.PriceAlert.Id}")
        api.PriceAlerts.Removed += lambda args: print(f"Price Alert removed: {args.PriceAlert.Id}")
        api.PriceAlerts.Updated += lambda args: print(f"Price Alert updated: {args.PriceAlert.Id}")
        api.PriceAlerts.Triggered += lambda args: print(f"Price Alert triggered: {args.PriceAlert.Id}")

        newPriceAlert = api.PriceAlerts.Add(api.Symbol, api.Symbol.Bid + (100 * api.Symbol.PipSize), PriceAlertQuoteType.Bid, PriceAlertCondition.HigherOrEqual)
        newPriceAlert.Update(api.Symbol, newPriceAlert.Price, newPriceAlert.QuoteType, newPriceAlert.Condition, True, "Price alert message")

        print(f"Finding price alert result: {api.PriceAlerts.Find(newPriceAlert.Id) == newPriceAlert}")

        api.PriceAlerts.Remove(newPriceAlert)
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## Methods

- `PriceAlert Add(Symbol symbol, double price, PriceAlertQuoteType quoteType, PriceAlertCondition condition)` — Adds a new price alert. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Add/index.md)
- `PriceAlert Find(long id)` — Finds a price alert by its Id. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Find/index.md)
- `PriceAlert[] FindAll(string symbolName)` — Finds all price alerts by their symbol. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/FindAll/index.md)
- `bool Remove(PriceAlert priceAlert)` — Removes a price alert. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Remove/index.md)

## Properties

- `int Count {get;}` — Gets the total number of active price alerts. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Count/index.md)

## Events

- `event Action<PriceAlertAddedEventArgs> Added;` — Occurs when a new price alert is added. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Added/index.md)
- `event Action<PriceAlertRemovedEventArgs> Removed;` — Occurs when a price alert is removed. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Removed/index.md)
- `event Action<PriceAlertTriggeredEventArgs> Triggered;` — Occurs when a price alert is triggered. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Triggered/index.md)
- `event Action<PriceAlertUpdatedEventArgs> Updated;` — Occurs when a price alert is updated. [details](https://help.ctrader.com/ctrader-algo/references/PriceAlert/PriceAlerts/Updated/index.md)

