The Strategy Module in EdgeCore serves as the decision-making engine that drives automated trading. It provides a structured framework for defining, combining, and executing trading strategies based on market conditions, technical indicators, and configurable logic.
Purpose
- Enables both simple and advanced trading logic
- Supports multi-timeframe analysis and signal generation
- Facilitates risk management, confluence analysis, and signal filtering
Core Components
Strategy Interface
- Defines the contract that all custom strategies must follow. Each strategy must implement methods to calculate indicators and generate trading signals.
Responsibilities
- Define timeframes (base and informative)
- Populate indicators and buy/sell signals
- Return data for dashboards and visualizations
- Handle startup candle requirements
Strategy Helper
Utility layer that provides:
- Multi-timeframe merging logic
- Stoploss calculation utilities
- Performance tracking decorators for bottleneck identification
SuperStrat
An advanced strategy manager that enables combining multiple strategies (entry and exit). It allows:
- Signal aggregation
- Timeframe synchronization
- Coordinated risk and position management
- Dynamic activation of ROI and trailing stop mechanisms
Strategy Implementations
Each strategy follows the IStrategy interface and has:
- Defined indicators and logic
- Buy/sell signal generation
- Optional confluence and filters
- Support for dashboard metrics and heatmaps
Key Functional Areas
Signal Generation
Strategies produce:
- Entry signals: when to initiate a position
- Exit signals: when to close a position
- Combined confluence logic for refined decision-making
Risk Management
Handled through:
- Configurable stoploss and take-profit values
- Optional trailing stop logic
- ROI-based exit activation
- Optional secondary stoploss thresholds
Multi-Timeframe Analysis
Supports merging higher timeframe data (e.g., 1h into 5m) to:
- Improve signal accuracy
- Avoid false positives
- Align with broader market structure
Dashboard & Visualization
Strategies output data for:
- Real-time dashboard metrics
- Strategy heatmaps
- Signal strength summaries
Internal Dependencies
- Data Module: Supplies market data
- Exchange Module: Executes trades
- Persistence Module: Stores strategy state
- Configuration Module: Supplies runtime parameters
Best Practices
- Start with minimal logic and expand gradually
- Use multiple indicators but avoid overfitting
- Optimize memory and CPU with selective calculations
- Validate against various market conditions
- Implement safeguards against signal spam
Performance & Security
- Use the timing decorator to monitor bottlenecks
- Avoid memory-intensive operations on large datasets
- Validate inputs to prevent logic faults
- Ensure only whitelisted strategies are loaded
Summary
The Strategy Module transforms market data into actionable trading decisions. Whether you're running a single strategy or orchestrating many with SuperStrat, this module is designed for flexibility, clarity, and control.