🧠 Advanced Features
Trade Protection & Profit Management
BananaEA includes trade management features for break-even, trailing stops, partial close, and related exit rules.
Break-Even Protection
What It Does
Automatically moves stop loss to entry price when trade reaches profit threshold, eliminating risk of loss.
⚠️ CRITICAL SETTING: Break-even is a toggle-based feature in v4.x.x. Proper configuration is essential for trade protection.
Settings
BreakEvenMethod - Toggle Control
What it does: Selects break-even calculation method (or disables feature entirely).
Configuration:
- Default: BE_ATR (ATR-based calculation)
- Options:
- BE_Disabled (0) — ❌ Feature OFF (SL stays at original distance)
- BE_Fixed (1) — Fixed pips
- BE_CandleRange (2) — Risk:Reward ratio
- BE_ATR (3) — ATR multiplier (recommended)
Why toggle-based is critical:
- ✅ Explicit control: You choose EXACTLY how break-even works
- ✅ Disable when needed: Set to "Disabled" for strategies that don't need BE
- ✅ Flexibility: Switch between Fixed pips, ATR, or R:R without code changes
- ⚠️ No ambiguity: "Disabled" means feature is OFF (not just set to 0 value)
BE_Value - Trigger Value
What it does: Break-even trigger value (meaning depends on BreakEvenMethod).
Configuration:
- Default: 2.0
- Context-aware:
- BE_Fixed: Value in pips (e.g., 20 = move BE after 20 pips profit)
- BE_ATR: Multiplier (e.g., 2.0 = move BE after 2 × ATR profit)
- BE_CandleRange: R:R ratio (e.g., 1.0 = move BE after 1R profit)
- BE_Disabled: Value ignored (feature is OFF)
Examples:
Aggressive (scalping):
BreakEvenMethod = BE_Fixed
BE_Value = 10 pips
→ Move to BE after 10 pips profit
Balanced (swing trading) - RECOMMENDED:
BreakEvenMethod = BE_ATR
BE_Value = 2.0
→ Move to BE after 2 × ATR profit
Conservative (position trading):
BreakEvenMethod = BE_ATR
BE_Value = 3.0
→ Move to BE after 3 × ATR profit
Disabled (no BE protection):
BreakEvenMethod = BE_Disabled
BE_Value = (ignored)
→ Feature is OFF, SL never moves to entry
How It Works
Example calculation:
Entry: 1.1000
SL: 1.0980 (20 pips)
TP: 1.1100 (100 pips)
BreakEvenTrigger = 1.0 ATR (= 10 pips)
BreakEvenOffset = 2 pips
Trade reaches 1.1010 (10 pips profit = 1.0 ATR)
→ SL moves to 1.1002 (entry + 2 pip offset)
→ Guaranteed 2 pip profit if reversed
Best Practices
Aggressive break-even (scalping):
BreakEvenMethod = BE_Fixed
BE_Value = 10 pips
- Moves to BE quickly
- Protects capital early
- Higher chance of BE stop-outs
Balanced break-even (swing trading) - RECOMMENDED:
BreakEvenMethod = BE_ATR
BE_Value = 2.0
- Gives trade room to breathe
- Adapts to market volatility
- Recommended for most traders
Conservative break-even (position trading):
BreakEvenMethod = BE_ATR
BE_Value = 3.0
- Only activates when trade well in profit
- Minimizes BE stop-outs
- Maximizes trend capture
Disabled (no BE protection):
BreakEvenMethod = BE_Disabled
- Feature completely OFF
- SL stays at original distance
- Use for strategies that need fixed SL
Partial Close
What It Does
Takes partial profit at target while leaving remaining position to run toward final TP.
⚠️ CRITICAL SETTING: Partial close is a toggle-based feature in v4.x.x. Proper configuration impacts profit capture strategy.
Settings
PartialCloseMethod - Toggle Control
What it does: Selects partial close calculation method (or disables feature entirely).
Configuration:
- Default: PC_ATR (ATR-based calculation)
- Options:
- PC_Disabled (0) — ❌ Feature OFF (trade runs to full TP or SL)
- PC_Fixed (1) — Fixed pips
- PC_CandleRange (2) — Risk:Reward ratio
- PC_ATR (3) — ATR multiplier (recommended)
Why toggle-based is critical:
- ✅ Profit strategy control: You decide HOW to take partial profits
- ✅ Disable when needed: Set to "Disabled" for let-winners-run strategies
- ✅ Method flexibility: Choose Fixed pips, ATR, or R:R based on market conditions
- ⚠️ Impact on returns: Partial close reduces max profit but improves consistency
PC_Value - Trigger Value
What it does: Partial close trigger value (meaning depends on PartialCloseMethod).
Configuration:
- Default: 1.0
- Context-aware:
- PC_Fixed: Value in pips (e.g., 30 = close partial after 30 pips profit)
- PC_ATR: Multiplier (e.g., 1.0 = close partial after 1 × ATR profit)
- PC_CandleRange: R:R ratio (e.g., 2.0 = close partial after 2R profit)
- PC_Disabled: Value ignored (feature is OFF)
PartialClosePercentage - Amount to Close
What it does: Percentage of position to close (as decimal).
Configuration:
- Default: 0.5 (50%)
- Range: 0.25–0.75 (25%–75%)
- Examples:
- 0.25 = Take small profit (25%), let majority run
- 0.5 = Balanced (50% secure, 50% run) - recommended
- 0.75 = Take most profit (75%), minimal runner
How It Works
Example:
Entry: 1 lot BUY at 1.1000
SL: 1.0980 (20 pips)
TP: 1.1100 (100 pips)
PartialCloseTrigger = 2.0 ATR (= 20 pips)
PartialClosePercent = 50%
Trade reaches 1.1020 (20 pips profit = 2.0 ATR)
→ Close 0.5 lot at 1.1020 (secure 10 pip profit × 0.5 lot)
→ Remaining 0.5 lot stays open targeting 1.1100
→ SL can be moved to BE on remaining position
Strategy Benefits
Why use partial close:
- ✅ Secures profits early (removes anxiety)
- ✅ Lets winners run (captures big moves)
- ✅ Reduces impact of reversals
- ✅ Improves psychological confidence
Profit comparison:
Without partial close:
- Win: +100 pips × 1 lot = +100 pips
- Loss (reversed from +50 pips): -20 pips × 1 lot = -20 pips
With partial close (50% at 2.0 ATR):
- Win: (+20 pips × 0.5 lot) + (+100 pips × 0.5 lot) = +60 pips
- Loss (reversed from +50 pips): (+20 pips × 0.5 lot) + (-20 pips × 0.5 lot) = 0 pips
Result: Partial close protected you from loss in reversal scenario.
Trailing Stop
What It Does
Follows price in profit, locking in gains while allowing trade to capture larger moves.
Important setting: Trailing stop is a toggle-based feature in v4.x.x with several calculation methods. Configuration changes can materially affect exit timing.
Settings
TrailingMethod - Toggle Control
What it does: Selects trailing stop calculation method (or disables feature entirely).
Configuration:
- Default: Trail_ATR (ATR-based calculation)
- Options:
- Trail_Disabled (0) — ❌ Feature OFF (SL stays fixed)
- Trail_Fixed (1) — Fixed pips
- Trail_ATR (2) — ATR multiplier (recommended)
- Trail_Candle (3) — Candle-based (bars)
- Trail_RMultiple (4) — Risk:Reward ratio
- Trail_MA (5) — Moving average-based
Why toggle-based is critical:
- ✅ Most flexible feature: 6 different trailing methods for different strategies
- ✅ Disable when needed: Set to "Disabled" for fixed SL strategies
- ✅ Method variety: From simple Fixed pips to advanced MA-based trailing
- ⚠️ Exit timing impact: Trailing method dramatically affects when trades close
Trail_ActivationValue - Activation Trigger
What it does: Minimum profit before trailing starts (meaning depends on TrailingMethod).
Configuration:
- Default: 5.0
- Context-aware:
- Trail_Fixed: Value in pips (e.g., 20 = start trailing after 20 pips profit)
- Trail_ATR: Multiplier (e.g., 5.0 = start after 5 × ATR profit)
- Trail_Candle: Bars (e.g., 3 = start after 3 bars in profit)
- Trail_RMultiple: R:R ratio (e.g., 2.0 = start after 2R profit)
- Trail_MA: Rs to start (0 = immediate)
- Trail_Disabled: Value ignored (feature is OFF)
Trail_DistanceValue - Trailing Distance
What it does: Distance to trail behind price (meaning depends on TrailingMethod).
Configuration:
- Default: 2.0
- Context-aware:
- Trail_Fixed: Value in pips (e.g., 15 = trail 15 pips behind price)
- Trail_ATR: Multiplier (e.g., 2.0 = trail 2 × ATR behind price)
- Trail_Candle: Bars (e.g., 2 = trail behind 2-bar high/low)
- Trail_RMultiple: R:R ratio (e.g., 1.0 = trail at 1R distance)
- Trail_MA: EMA period (e.g., 20 = use 20 EMA as trailing stop)
- Trail_Disabled: Value ignored (feature is OFF)
TrailMinimumMovement - Update Threshold
What it does: Minimum price movement in pips required to update trailing SL.
Configuration:
- Default: 1.0 pips
- Range: 0.5–20 pips
- Purpose: Reduces broker API calls by reduced (avoid micro-trailing, saves costs)
How It Works
Example:
Entry: 1.1000 BUY
SL: 1.0980 (20 pips)
TrailingTrigger = 1.5 ATR (= 15 pips)
TrailingDistance = 1.0 ATR (= 10 pips)
Price reaches 1.1015 (15 pips profit = 1.5 ATR)
→ Trailing activates
→ SL moves to 1.1005 (current price 1.1015 - 10 pips trailing distance)
Price continues to 1.1040
→ SL trails to 1.1030 (1.1040 - 10 pips)
→ Locked in 30 pips profit
Price reverses to 1.1030
→ SL triggered at 1.1030
→ Trade closes with 30 pip profit (instead of riding it back down)
Trailing Strategies
Tight trailing (scalping):
TrailingMethod = Trail_Fixed
Trail_ActivationValue = 10 pips
Trail_DistanceValue = 8 pips
TrailMinimumMovement = 2 pips
- Follows price closely
- Captures small moves
- Higher chance of early exits
Balanced trailing (swing trading) - RECOMMENDED:
TrailingMethod = Trail_ATR
Trail_ActivationValue = 5.0 (5 × ATR)
Trail_DistanceValue = 2.0 (2 × ATR)
TrailMinimumMovement = 1.0 pips
- Adapts to market volatility
- Balances capture vs exits
- Recommended for most traders
Wide trailing (trend trading):
TrailingMethod = Trail_ATR
Trail_ActivationValue = 8.0 (8 × ATR)
Trail_DistanceValue = 3.0 (3 × ATR)
TrailMinimumMovement = 2.0 pips
- Maximizes trend capture
- Minimizes premature exits
- Best for strong trending markets
Advanced: MA-based trailing:
TrailingMethod = Trail_MA
Trail_ActivationValue = 0 (immediate)
Trail_DistanceValue = 20 (20 EMA)
TrailMinimumMovement = 1.0 pips
- Uses moving average as dynamic SL
- Follows trend structure
- Advanced strategy for experienced traders
Disabled (no trailing):
TrailingMethod = Trail_Disabled
- Feature completely OFF
- SL stays at original distance (or BE if activated)
- Use for fixed TP strategies
Combining Features
Example 1: Maximum Protection Strategy
Goal: Secure profits at every stage, minimize risk.
BreakEvenMethod = BE_ATR
BE_Value = 2.0 (2 × ATR)
PartialCloseMethod = PC_ATR
PC_Value = 3.0 (3 × ATR)
PartialClosePercentage = 0.5 (50%)
TrailingMethod = Trail_ATR
Trail_ActivationValue = 5.0 (5 × ATR)
Trail_DistanceValue = 2.0 (2 × ATR)
TrailMinimumMovement = 1.0 pips
Workflow:
- Trade reaches 1.0 ATR profit → Move to break-even (no risk)
- Trade reaches 2.0 ATR profit → Close 50% (secure profit)
- Trade reaches 3.0 ATR profit → Start trailing remaining 50%
- Remaining position trails to capture extended moves
Example 2: Let Winners Run Strategy
Goal: Capture higher-risk on winning trades.
BreakEvenMethod = BE_ATR
BE_Value = 3.0 (3 × ATR)
PartialCloseMethod = PC_Disabled
TrailingMethod = Trail_ATR
Trail_ActivationValue = 3.0 (3 × ATR)
Trail_DistanceValue = 3.0 (3 × ATR)
TrailMinimumMovement = 2.0 pips
Workflow:
- Trade reaches 2.0 ATR profit → Move to break-even + start trailing
- No partial close (full position stays)
- Wide trailing distance (2.0 ATR) gives trade maximum room
- Captures full profit of trending moves
Example 3: Scalping Strategy
Goal: Quick in, quick out with secured profits.
BreakEvenMethod = BE_Fixed
BE_Value = 10 pips
PartialCloseMethod = PC_Fixed
PC_Value = 20 pips
PartialClosePercentage = 0.75 (75%)
TrailingMethod = Trail_Disabled
Workflow:
- Trade reaches 0.5 ATR → Move to break-even quickly
- Trade reaches 1.0 ATR → Close 75% (secure most profit)
- Remaining 25% runs to full TP
- No trailing (rely on fixed TP for remaining position)
Best Practices
Feature Activation Order
Logical progression:
- Break-even (earliest) → Eliminates risk
- Partial close (middle) → Secures initial profit
- Trailing (latest) → Maximizes extended profit
Recommended timing:
BE_Value < PC_Value < Trail_ActivationValue
Example (ATR-based):
BreakEvenMethod = BE_ATR, BE_Value = 2.0
PartialCloseMethod = PC_ATR, PC_Value = 3.0
TrailingMethod = Trail_ATR, Trail_ActivationValue = 5.0
Result:
Break-even at 2 × ATR
Partial close at 3 × ATR
Trailing starts at 5 × ATR
ATR vs Fixed Pips
For advanced features, ATR-based is recommended:
- Adapts to market volatility
- Works across different trading sessions
- Consistent behavior across symbols
Fixed pips can be used for:
- Specific strategies with consistent volatility
- Backtested exact values
- Simple, predictable behavior
Performance Optimization
Test these combinations in backtesting:
- Break-even only
- Break-even + partial close
- Break-even + trailing
- All three features combined
Analyze:
- Win rate impact
- Average profit per trade
- Maximum drawdown
- Profit factor
Troubleshooting
Issue: Break-Even Triggered Too Early
Symptoms: Many trades hit BE then reverse for full TP.
Solutions:
- Increase
BreakEvenTrigger(try 1.5 or 2.0 ATR) - Review entry quality (early BE may indicate weak entries)
- Consider skipping BE for trend-following strategies
Issue: Partial Close Reduces Profit
Symptoms: Winners would have hit full TP with full position.
Solutions:
- Reduce
PartialClosePercent(try 25% instead of 50%) - Increase
PartialCloseTrigger(close later, closer to TP) - Test disabling partial close for trending markets
Issue: Trailing Stops Out Too Early
Symptoms: Trade trails then stops out before reaching TP.
Solutions:
- Increase
TrailingDistance(give trade more room) - Increase
TrailingTrigger(start trailing later) - Increase
TrailMinimumMovement(reduce micro-adjustments) - Consider using break-even + fixed TP instead
Robustness Metrics
What It Does
BananaEA v4.5.1 includes composite fitness scoring that combines multiple robustness metrics to evaluate EA performance beyond simple profit.
Composite Fitness Score
What it measures: Overall EA quality using industry-standard robustness metrics.
Components:
- Sharpe Ratio — Risk-adjusted returns (return per unit of volatility)
- Calmar Ratio — Return vs maximum drawdown (higher = better risk management)
- Recovery Factor — Net profit divided by maximum drawdown (profit efficiency)
Why it matters:
- Optimization: MT4 Strategy Tester can optimize for composite fitness, not just profit
- Real-world viability: High composite fitness = sustainable, robust trading strategy
- Risk awareness: Balances profit with drawdown control and consistency
Configuration
Optimization setup:
In Strategy Tester → Optimization Settings:
Custom Optimization Criterion = "Composite Fitness"
How to enable:
- Open MT4 Strategy Tester
- Select BananaEA Expert Advisor
- Click "Expert Properties"
- Check "Optimization" tab
- Select "Custom" optimization criterion
- EA will use composite fitness automatically
Metric Breakdown
Sharpe Ratio:
- Formula: (Average Return - Risk-Free Rate) / Standard Deviation of Returns
- Purpose: Compares historical return with volatility.
- Review note: Treat it as one comparison metric. It can be distorted by small samples or unusual trades.
Calmar Ratio:
- Formula: Annual Return / Maximum Drawdown
- Purpose: Compares historical return with maximum drawdown.
- Review note: It depends on the selected test period and should not be used alone.
Recovery Factor:
- Formula: Net Profit / Maximum Drawdown
- Purpose: Compares net result with maximum drawdown.
- Review note: A high value can still be misleading if the trade count is low or the result depends on one period.
Example Comparison
Candidate A
Trade count: Higher
Drawdown: Higher
Result distribution: Concentrated in one period
Review note: Needs further validation
Candidate B
Trade count: Similar
Drawdown: Lower
Result distribution: More even across the period
Review note: Worth out-of-sample testing
Use these comparisons to decide what deserves more testing. Do not treat the composite score as proof of future performance.
Best Practices
Optimization workflow:
- Run optimization with composite fitness criterion
- Review top 10 results
- Prioritize sets with:
- Sharpe > 1.5
- Calmar > 2.0
- Recovery > 3.0
- Forward test top candidates on demo account
Live deployment:
- Choose optimization sets with highest composite fitness
- Avoid sets where historical profit is high but drawdown or trade distribution is poor
- Monitor live metrics alongside profit
💡 See also: Robustness Metrics Guide for in-depth metric analysis.
Optimization Set Identification
What It Does
Labels your current EA configuration for easy tracking and comparison of different optimization sets.
Settings
OptimizationSetName
What it does: Displays a custom name on the dashboard to identify which optimization set is currently active.
Configuration:
- Default: "" (empty string)
- Format: Text string (alphanumeric + underscores recommended)
- Visibility: Shows in dashboard panel for instant identification
- Purpose: Track which optimization pass/strategy is deployed
Use Cases
Multiple optimization sets:
Set A: "DAX_M5_Conservative_v1.2"
Set B: "DAX_M5_Aggressive_v1.2"
Set C: "EURUSD_H1_Balanced_v2.0"
Dashboard shows: "Active Set: DAX_M5_Conservative_v1.2"
Version tracking:
"Champion_Pass6859_Dec2025"
"Conservative_Pass4950_Nov2025"
"HighFreq_Pass7234_Jan2026"
Easily identify which optimization pass is deployed
Strategy variants:
"Prop_Firm_Conservative"
"Personal_Aggressive"
"Low_DD_Safe_Mode"
Naming Best Practices
Include:
- Symbol: DAX, EURUSD, GBPUSD
- Timeframe: M5, H1, H4
- Strategy type: Conservative, Aggressive, Balanced
- Version/Date: v1.0, Dec2025, Pass6859
Format examples:
[Symbol]_[Timeframe]_[Strategy]_[Version]
DAX_M5_Conservative_v1.2
EURUSD_H1_Balanced_Dec2025
GBPUSD_M15_Aggressive_Pass7234
Recommendations:
- Use underscores (not spaces)
- Keep under 30 characters
- Be descriptive but concise
- Update when switching optimization sets
💡 See also: General Settings for detailed parameter documentation.
Related Settings
- Stop Loss & Take Profit - SL/TP calculation methods
- Trade Management Mode - Magic = 0 enhancements
- Risk Management - Position sizing with advanced features
- General Settings - OptimizationSetName parameter details
Quick Reference
| Feature | Recommended Trigger | Purpose |
|---|---|---|
| Break-Even | 1.0 ATR | Eliminate risk |
| Partial Close | 2.0 ATR | Secure initial profit |
| Trailing Stop | 1.5-3.0 ATR | Capture extended moves |
Balanced configuration (recommended):
BreakEvenMethod = BE_ATR
BE_Value = 2.0 (2 × ATR)
PartialCloseMethod = PC_ATR
PC_Value = 3.0 (3 × ATR)
PartialClosePercentage = 0.5 (50%)
TrailingMethod = Trail_ATR
Trail_ActivationValue = 5.0 (5 × ATR)
Trail_DistanceValue = 2.0 (2 × ATR)
TrailMinimumMovement = 1.0 pips
Robustness metric targets:
Sharpe Ratio: review relative to trade count and volatility
Calmar Ratio: review relative to maximum drawdown
Recovery Factor: review relative to historical drawdown
Composite Fitness: use as a sorting aid, not as a live-readiness signal