MagicTradeBot Brain
Internal Intelligent Decision Engine for Trade Management
MagicTradeBot Brain is the platform’s internal intelligence layer — a fully self-contained decision-making engine responsible for monitoring, evaluating, and closing trades dynamically based on real-time market behavior, trade lifecycle data, and strategy context.
It completely replaces exchange-provided stop-loss and take-profit mechanisms, which are often static, limited, unreliable, and poorly supported by exchange APIs.
Instead of relying on rigid exchange-side logic, MagicTradeBot Brain executes all critical decisions internally, ensuring consistency, flexibility, and advanced control across all supported exchanges.
Why MagicTradeBot Brain Exists
Exchange-based SL/TP systems suffer from major limitations:
- Static thresholds that don’t adapt to market conditions
- Partial or inconsistent API support across exchanges
- No awareness of trade age, DCA depth, or market context
- Inability to combine time, candles, volatility, and profit logic
- Poor handling during high volatility or API delays
MagicTradeBot Brain solves this by acting as a centralized, exchange-agnostic intelligence engine that continuously evaluates trades and decides when, how, and why they should be closed.
Core Responsibilities of the Brain Engine
MagicTradeBot Brain continuously monitors every active trade and can trigger trade exits based on:
- Dynamic stop-loss thresholds
- Candle-based reversal detection
- Time-based trade aging rules
- Emergency close scenarios
- DCA-aware risk management
- Partial and full take-profit logic
- Global risk and loss controls
All decisions are evaluated locally and in real time, independent of exchange-side logic.
Intelligent Template-Based Decision System
At the heart of the Brain is a template-driven decision framework.
How Template Selection Works
The engine analyzes recent market signals to determine context:
- Counts BUY and SELL signals over a rolling window (e.g., last 4 hours)
Determines market state:
- Bullish (more BUY signals)
- Bearish (more SELL signals)
- Neutral (balanced signals)
Selects the most appropriate decision template based on:
- Signal count thresholds
- Market direction
- Strategy intent
This allows MagicTradeBot to adapt its trade exit behavior automatically without manual intervention.
Intelligent Rule Engine (Per Template)
Each template defines a complete behavioral profile for trade management.
Time-Based Intelligence
- Minimum hold time to avoid premature exits
- Maximum hold time to prevent capital lockup
- Direction-specific max durations (long vs short)
- Automatic extension of hold time based on DCA depth (e.g., extra time per DCA order)
This ensures trades are judged in context, not blindly.
Dynamic Stop-Loss Logic
Unlike fixed stop-loss orders, the Brain supports:
- Time-segmented stop-loss rules (different thresholds at different trade ages)
Dynamic stop-loss based on:
- Highest favorable price reached
- Lowest adverse price reached
- Percentage-based adaptive SL that evolves with price action
Optional conditional exits:
- Close only if in profit
- Close only if in loss
This enables smart survival during volatility and tight control during calm markets.
Candle-Based Exit Intelligence
The Brain can exit trades based on price structure, not just percentages.
Supported logic includes:
- Detecting consecutive opposite candles
- Confirming reversals before exiting
- Partial or full exits based on candle patterns
- Optional minimum profit requirement before candle-based exit
This makes trade exits market-aware, not mechanically reactive.
Advanced Take-Profit System
MagicTradeBot Brain supports multi-stage take-profit logic:
- Partial profit-taking at predefined profit levels
- Full position closure at higher targets
- Market or limit-based execution
- Direction-specific TP strategies for long and short trades
This allows profits to be secured progressively, not all at once.
DCA-Aware Decision Making
The Brain is fully aware of DCA behavior:
All SL/TP calculations can be based on:
- Initial entry price
- Average DCA-adjusted entry price
- Trade duration rules can scale with DCA depth
- Risk tolerance adapts as exposure increases
This prevents one-size-fits-all exits in multi-entry strategies.
Emergency Close Intelligence
MagicTradeBot Brain can immediately override all logic and force-close trades when:
- Market conditions become abnormal
- Volatility exceeds safety thresholds
- External risk events are detected
- Global loss limits are breached
Emergency closes are context-aware, not panic-driven.
Global Safety & Capital Protection
Beyond per-trade logic, the Brain enforces account-level protection:
- Minimum profit threshold before enabling take-profit logic
- Maximum loss cap before forced trade closure
- Absolute safeguards independent of templates or strategies
This ensures system-wide risk containment, even during extreme scenarios.
Key Advantages Over Exchange SL/TP
- Works consistently across all exchanges
- No reliance on fragile exchange-side logic
- Combines time, candles, volatility, DCA, and profit rules
- Fully customizable and strategy-driven
- Designed for real-world market chaos
MagicTradeBot Brain doesn’t just close trades — it understands when not to.
In Simple Terms
If Market Watch is the eyes of MagicTradeBot, the Brain is its decision-making core.
It observes, evaluates, adapts, and acts — with precision that static exchange tools simply cannot match.