Alert
The Alert module provides comprehensive price and technical indicator-based alerting functionality. It supports various trigger conditions, actions, and notification methods for real-time market monitoring.
Key Features
- Price-based alerts (open, high, low, close, volume)
- Technical indicator-based alerts
- Multiple trigger conditions (greater than, crosses above, moving up, etc.)
- Action execution on trigger (popup, sound, webhook, email)
- Alert expiration and one-time triggers
- Real-time evaluation with configurable throttling
Architecture / Behavior
The Alert module is implemented through the AlertsManager class which subscribes to real-time data feeds and evaluates alert conditions against incoming bars. It uses the IndicatorOperandEvaluator for technical indicator calculations and integrates with the NotificationManager for user notifications.
API Usage
Initialization
Alerts are enabled by default in the chart configuration:
const chart = Chart.create(document.getElementById('container'), {
// ... other options
enabled_features: ['alert'], // Enable alert functionality
});
Methods
// Create a new alert
const alertId = chart.createAlert({
symbol: 'AAPL',
condition: {
leftOperand: 'close',
operator: 'greater than',
rightOperand: 150
},
actions: {
popup: true,
sound: true,
email: false
}
});
// Update an existing alert
chart.updateAlert(alertId, {
condition: {
leftOperand: 'sma-20',
operator: 'crosses above',
rightOperand: 'ema-50'
}
});
// Delete an alert
chart.deleteAlert(alertId);
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
enabled_features | string[] | ['alert'] | Enable/disable alert functionality |
alert_evaluation_throttle_ms | number | 100 | Minimum time between alert evaluations |
alert_expiration | string | null | ISO date string for alert expiration |
Events
The Alert module emits events through the GlobalStore:
alert:added- When a new alert is createdalert:removed- When an alert is deletedalert:updated- When an alert is modifiedalert:triggered- When an alert condition is metalert:state_updated- When alert state changes (lastValue, triggerCount, etc.)
Customization
- Alert sound can be customized via SoundUtils
- Alert notification styling can be customized via CSS classes
- Alert conditions support custom indicators and complex expressions
Use Cases
- Price breakout alerts
- Technical indicator crossovers
- Volume surge detection
- Support/resistance level breaks
- Earnings announcement alerts
Limitations
- Requires data feed implementation of
getAlerts,createAlert,updateAlert, and related methods - Complex indicator expressions require proper indicator configuration
- No built-in alert history or logging
✅ Supported
- Comprehensive alert condition evaluation
- Multiple action types (popup, sound, webhook, email)
- Real-time evaluation with throttling
- Technical indicator-based alerts
❌ Not Supported
- Alert sharing between users
- Advanced alert scheduling
- Multi-condition AND/OR logic
⚠️ Partial / Custom
- Alert persistence requires custom data feed implementation
- Alert history and reporting requires custom implementation
Integration
This module should be linked from:
- Charting section → Right Sidebar Panels
- Advanced Features → Modules
- API Reference → Alert Interface