# Alerts & Notifications

## Overview

BananaEA v{{ variables.productionVersion }} includes a **comprehensive Smart Alert System** that provides real-time notifications for all critical trading events. The system is designed with professional traders in mind, offering granular control over alert types while automatically disabling during backtesting and optimization to prevent spam.

{% hint style="success" %}
**Intelligent Design**: Alerts automatically disable during Strategy Tester backtests and optimizations - no manual configuration needed!
{% endhint %}

***

## Master Alert Control

### Enable/Disable All Alerts

The master switch provides instant control over the entire alert system:

```
EnableAlerts = true   // All alerts active (default)
EnableAlerts = false  // All alerts disabled
```

**When to disable**:

* During live trading setup/testing phase
* When running multiple EA instances (reduce alert volume)
* If you prefer quiet operation

{% hint style="info" %}
Individual alert switches work ONLY when `EnableAlerts = true`. The master switch overrides all individual settings.
{% endhint %}

***

## Alert Categories

### 1. Trade Execution Alerts

Real-time notifications for all trade placement and management events.

#### Signal Triggered Trade

**Parameter**: `Alert_Signal = true`

Notifies when a Banana or Seed signal results in trade placement (market or pending order).

**Alert Format**:

```
[BananaEA v3.13.x] SIGNAL TRIGGERED: BUY #12345
Symbol: GER40.r | Type: Bu1 (Banana Buy #1)
Entry: 19000.5 | SL: 18950.0 | TP: 19100.0
```

**When triggered**:

* Banana Buy/Sell signals (Bu1, Bu2, Bu3, Be1, Be2, Be3)
* Seed signals (small pattern confirmation)
* External indicator signals (if enabled)

***

#### Pending Order Placed

**Parameter**: `Alert_PendingOrder = true`

Confirms when pending orders (BuyStop, SellStop, BuyLimit, SellLimit) are successfully placed.

**Alert Format**:

```
[BananaEA v3.13.x] PENDING ORDER PLACED: BUY STOP #12346
Symbol: GER40.r | Entry: 19050.0
Distance: 45.0 pips | Expires: Never
```

***

#### Pending Order Deleted

**Parameter**: `Alert_PendingDelete = true`

Notifies when pending orders are removed (replaced by better signal, expired, or manually deleted).

**Alert Format**:

```
[BananaEA v3.13.x] PENDING ORDER DELETED: #12346
Reason: Replaced with fresh signal
Old Entry: 19050.0 | New Entry: 19055.0
```

***

#### Partial Close Executed

**Parameter**: `Alert_PartialClose = true`

Alerts when the EA closes a portion of the position (typically 50% at partial close trigger).

**Alert Format**:

```
[BananaEA v3.13.x] PARTIAL CLOSE EXECUTED: #12345
Original Lot: 5.00 | Closed: 3.00 | Remaining: 2.00
Profit Secured: €450.00 (24.2 pips)
```

**Trigger Points**:

* Fixed level (e.g., +50 pips)
* Candle range multiplier (e.g., 2× signal candle)
* ATR multiplier (e.g., 3× ATR from entry)

***

#### Trade Fully Closed

**Parameter**: `Alert_TradeClose = true`

Confirms when trades are completely closed (by SL, TP, trailing stop, or manual intervention).

**Alert Format**:

```
[BananaEA v3.13.x] TRADE CLOSED: #12345
Exit Reason: Take Profit Hit
Final Profit: €680.00 (+68.0 pips)
Duration: 4h 23m
```

***

### 2. Risk Management Alerts

Automated protection mechanisms and safety triggers.

#### Break-Even Activated

**Parameter**: `Alert_BreakEven = true`

Notifies when the EA moves stop loss to entry price (zero-risk position).

**Alert Format**:

```
[BananaEA v3.13.x] BREAK-EVEN ACTIVATED: #12345
Symbol: GER40.r | Trade: BUY 5.00 lots
Original SL: 18950.0 → New SL: 19000.5 (entry price)
Current Profit: +4.5R (€340.00)
```

**Trigger Methods**:

* **Fixed**: After X pips in profit
* **Candle Range**: After price moves X× signal candle size
* **ATR-based**: After price moves X× ATR from entry (default: 4× ATR)

***

#### Trailing Stop Started

**Parameter**: `Alert_TrailingStop = true`

Confirms when dynamic trailing stop activation begins.

**Alert Format**:

```
[BananaEA v3.13.x] TRAILING STOP STARTED: #12345
Symbol: GER40.r | Activation: +50.0 pips
Current Profit: €500.00 (+50 pips)
Trailing Method: ATR-based (1.5× ATR step)
```

***

#### Daily Drawdown Warnings

**Parameter**: `Alert_DailyDrawdown = true`

Progressive alerts as daily loss limits approach critical thresholds.

**Alert Levels**:

**⚠️ Warning (60-80% of limit)**:

```
[BananaEA v3.13.x] DAILY DRAWDOWN WARNING
Current Loss: €-450.00 (75% of limit)
Limit: €-600.00
Remaining: €-150.00
New trades allowed but caution advised
```

**🛑 Critical (80-100% of limit)**:

```
[BananaEA v3.13.x] DAILY DRAWDOWN CRITICAL
Current Loss: €-540.00 (90% of limit)
Limit: €-600.00
Remaining: €-60.00
EA will stop trading if limit reached!
```

**🚨 Limit Reached (100%)**:

```
[BananaEA v3.13.x] DAILY DRAWDOWN LIMIT HIT
Daily Loss: €-600.00
EA DISABLED for rest of day
Resets at midnight (server time)
```

***

### 3. System & Session Alerts

Market conditions and operational status notifications.

#### Session Status Change

**Parameter**: `Alert_SessionChange = true`

Alerts when trading windows activate or deactivate.

**Alert Format (Active)**:

```
[BananaEA v3.13.x] TRADING SESSION ACTIVE
Start Time: 10:00 (London Open)
End Time: 17:00
Status: Actively monitoring signals
```

**Alert Format (Inactive)**:

```
[BananaEA v3.13.x] TRADING SESSION CLOSED
Current Time: 17:05
Next Session: Tomorrow 10:00
Status: Position management only (no new trades)
```

***

#### Order Rejection

**Parameter**: `Alert_OrderRejected = true`

Critical alert when broker rejects order placement.

**Alert Format**:

```
[BananaEA v3.13.x] ORDER REJECTED
Symbol: GER40.r | Type: BUY
Reason: Invalid stops (ERR_INVALID_STOPS)
Entry: 19000.0 | SL: 18999.5 | TP: 19100.0
Action: Check broker min stop level requirements
```

**Common Rejection Reasons**:

* `ERR_INVALID_STOPS`: SL/TP too close to entry price
* `ERR_NOT_ENOUGH_MONEY`: Insufficient margin
* `ERR_TRADE_DISABLED`: Trading disabled for symbol
* `ERR_TRADE_NOT_ALLOWED`: EA trading permission denied

***

#### High Spread Warning

**Parameter**: `Alert_HighSpread = false` (disabled by default)

Optional alert for abnormal spread conditions.

**Alert Format**:

```
[BananaEA v3.13.x] HIGH SPREAD WARNING
Symbol: GER40.r
Current Spread: 12.5 pips
Normal Spread: 1.5 pips
Threshold: 5.0 pips
Action: Signal blocked until spread normalizes
```

**Configuration**:

```
Alert_HighSpread = true              // Enable high spread alerts
Alert_SpreadThreshold = 5.0          // Alert threshold in pips
```

{% hint style="warning" %}
**High Spread Alerts** can be noisy during news events and market opens. Recommended to keep disabled unless actively monitoring spreads.
{% endhint %}

***

## Alert Protection Mechanisms

### Automatic Backtest/Optimization Silence

The Smart Alert System includes **four-layer protection** to prevent alert spam:

```mql4
void SendSmartAlert(string alertMessage, bool individualSwitch) {
   // Protection 1: Master switch check
   if(!EnableAlerts) return;

   // Protection 2: Individual alert type switch
   if(!individualSwitch) return;

   // Protection 3: Skip during backtesting
   if(IsTesting()) return;

   // Protection 4: Skip during optimization
   if(IsOptimization()) return;

   // Send alert with EA version prefix
   Alert("[BananaEA v" + EA_VERSION + "] " + alertMessage);
}
```

**Result**: Zero configuration needed - alerts automatically work only during live/demo trading.

***

### Anti-Spam for Break-Even & Trailing Stop

Special tracking prevents duplicate alerts for the same trade:

**Problem**: Trade #12345 moves SL 10 times during trailing stop → 10 alerts ❌\
**Solution**: Alert only on FIRST SL move → 1 alert per trade ✅

**Implementation**:

* Break-Even: Alert once when SL first moved to entry price
* Trailing Stop: Alert once when trailing first activates
* Subsequent SL adjustments: Silent (logged only)

***

## Alert Configuration Profiles

### Conservative Trader

**Goal**: Maximum awareness, all alerts enabled

```
EnableAlerts = true
Alert_PartialClose = true
Alert_TradeClose = true
Alert_Signal = true
Alert_PendingOrder = true
Alert_PendingDelete = true
Alert_BreakEven = true
Alert_TrailingStop = true
Alert_DailyDrawdown = true
Alert_SessionChange = true
Alert_OrderRejected = true
Alert_HighSpread = true         // Optional: Enable for full monitoring
Alert_SpreadThreshold = 3.0     // Tight threshold
```

***

### Balanced Trader (Default)

**Goal**: Essential alerts only, minimal noise

```
EnableAlerts = true
Alert_PartialClose = true       // Important: profit secured
Alert_TradeClose = true         // Important: final result
Alert_Signal = true             // Important: new trades
Alert_PendingOrder = true       // Good to know: pending orders
Alert_PendingDelete = false     // Optional: reduce noise
Alert_BreakEven = true          // Important: risk eliminated
Alert_TrailingStop = true       // Important: profit protection
Alert_DailyDrawdown = true      // Critical: risk control
Alert_SessionChange = false     // Optional: session changes obvious
Alert_OrderRejected = true      // Critical: must know failures
Alert_HighSpread = false        // Disable: too noisy
```

***

### Silent Trader

**Goal**: Minimal interruptions, critical alerts only

```
EnableAlerts = true
Alert_PartialClose = false      // Check manually
Alert_TradeClose = true         // Must know: final results
Alert_Signal = false            // Check chart for signals
Alert_PendingOrder = false      // Check manually
Alert_PendingDelete = false     // Not critical
Alert_BreakEven = false         // Check manually
Alert_TrailingStop = false      // Check manually
Alert_DailyDrawdown = true      // Critical: must know limits
Alert_SessionChange = false     // Not critical
Alert_OrderRejected = true      // Critical: must know failures
Alert_HighSpread = false        // Not critical
```

***

### Completely Silent (Manual Monitoring)

**Goal**: No interruptions, full manual control

```
EnableAlerts = false            // Master switch OFF (overrides all individual settings)
```

***

## Alert Format Standards

All BananaEA alerts follow consistent formatting:

### Prefix

```
[BananaEA v4.4.6]
```

### Structure

```
[EA NAME + VERSION] EVENT TYPE: DETAILS
Key Info: Value | Key Info: Value
Action/Context: Explanation
```

### Example

```
[BananaEA v3.13.x] PARTIAL CLOSE EXECUTED: #12345
Original Lot: 5.00 | Closed: 3.00 | Remaining: 2.00
Profit Secured: €450.00 (24.2 pips)
```

***

## Technical Notes

### Alert Performance

* **Processing Time**: <0.1ms per alert (negligible overhead)
* **Memory Usage**: \~200 bytes per alert message
* **Optimization Impact**: Zero (alerts disabled automatically)
* **Backtest Impact**: Zero (alerts disabled automatically)

### Alert Triggers

**Synchronous (Immediate)**:

* Trade execution alerts (signal, pending order, close)
* Order rejection alerts
* Break-even activation
* Trailing stop activation

**Asynchronous (On Next Tick)**:

* Session status changes (evaluated once per bar)
* Daily drawdown warnings (evaluated on new trades)
* High spread warnings (evaluated before signal execution)

***

## Troubleshooting

### Not Receiving Alerts

**Check 1: Master Switch**

```
EA Inputs → EnableAlerts = true
```

**Check 2: Individual Switch**

```
EA Inputs → Alert_Signal = true (for signal alerts)
```

**Check 3: Trading Mode**

```
Alerts work in: Live Trading, Demo Trading
Alerts disabled in: Strategy Tester, Optimization
```

**Check 4: MT4 Settings**

```
Tools → Options → Events → Enable "Alert notifications"
```

***

### Too Many Alerts

**Solution 1: Disable Noisy Alerts**

```
Alert_HighSpread = false        // Most common cause
Alert_PendingDelete = false     // If using pending orders frequently
```

**Solution 2: Use Balanced Profile**

* Enable only critical alerts (close, rejection, drawdown)
* Disable informational alerts (session change, pending orders)

**Solution 3: Silent Mode**

```
EnableAlerts = false            // Complete silence
```

***

### Missing Specific Alerts

**Break-Even not alerting?**

```
Check: UseSLtoBE = true (break-even must be enabled)
Check: Alert_BreakEven = true
```

**Trailing Stop not alerting?**

```
Check: UseTrailingStop = true (trailing must be enabled)
Check: Alert_TrailingStop = true
```

**Daily Drawdown not alerting?**

```
Check: UseDailyDrawdownControl = true (drawdown control enabled)
Check: Alert_DailyDrawdown = true
```

***

## Best Practices

### 1. Start with Defaults

Use the **Balanced Trader** profile initially. Adjust based on your monitoring style after 1-2 weeks.

### 2. Enable Critical Alerts Always

**Mandatory Alerts** (should always be enabled):

* `Alert_OrderRejected = true` - Must know when orders fail
* `Alert_DailyDrawdown = true` - Must know risk limits approaching
* `Alert_TradeClose = true` - Must know final trade results

### 3. Progressive Alert Reduction

**Week 1**: Enable all alerts → Understand EA behavior\
**Week 2**: Disable noisy alerts → Find your comfort level\
**Week 3+**: Fine-tune to minimal essential alerts → Long-term sustainability

### 4. Mobile Notifications

**MT4 Mobile App**: Alerts sync to mobile automatically if:

* MT4 Mobile installed and logged in
* Push notifications enabled in mobile settings
* Same account used on desktop and mobile

### 5. Alert Logs

All alerts are also logged to MT4 Experts tab:

```
Experts → BananaEA v4.4.6
```

Filter logs: `Right-click → Filter → "ALERT"`

***

## Version History

| Version  | Alert Feature      | Description                                                                |
| -------- | ------------------ | -------------------------------------------------------------------------- |
| v3.13.x  | Smart Alert System | Comprehensive 11-alert system with automatic backtest/optimization silence |
| v3.13.12 | ATR Filter Alert   | Added ATR volatility filter rejection notifications                        |
| v3.13.13 | Daily Range Alert  | Added daily range exceeded and session movement alerts                     |
| v3.13.x  | Alert Anti-Spam    | Break-even and trailing stop duplicate alert prevention                    |

***

## Related Documentation

* [Risk Management](https://itradeaims.gitbook.io/banana-ea/smart-features/overview/risk-management) - Daily drawdown control and break-even settings
* [Signal Processing](https://itradeaims.gitbook.io/banana-ea/smart-features/overview/signal-processing) - Understanding when signals trigger alerts
* [Smart Trailing Stop](https://itradeaims.gitbook.io/banana-ea/smart-features/overview/smart-trailing-stop) - Trailing stop activation alerts
* [Settings Explained](https://github.com/itradeaims/bananaEA-dev/blob/dev/gitbook/settings-explained.md) - Complete parameter reference

***

{% hint style="success" %}
**Pro Tip**: Use alert logs as a trading journal. Review `Alert_TradeClose` messages to analyze your trade history and identify patterns!
{% endhint %}
