- Introduced `config_utils.py` for loading and managing strategy configurations, including functions for loading templates, generating dropdown options, and retrieving parameter schemas and default values. - Added JSON templates for EMA Crossover, MACD, and RSI strategies, defining their parameters and validation rules to enhance modularity and maintainability. - Implemented `StrategyManager` in `manager.py` for managing user-defined strategies with file-based storage, supporting easy sharing and portability. - Updated `__init__.py` to include new components and ensure proper module exports. - Enhanced error handling and logging practices across the new modules for improved reliability. These changes establish a robust foundation for strategy management and configuration, aligning with project goals for modularity, performance, and maintainability.
77 lines
2.2 KiB
JSON
77 lines
2.2 KiB
JSON
{
|
|
"type": "macd",
|
|
"name": "MACD Strategy",
|
|
"description": "Moving Average Convergence Divergence strategy that generates signals based on MACD line crossovers with the signal line and zero line.",
|
|
"category": "trend_following",
|
|
"parameter_schema": {
|
|
"fast_period": {
|
|
"type": "int",
|
|
"description": "Fast EMA period for MACD calculation",
|
|
"min": 5,
|
|
"max": 30,
|
|
"default": 12,
|
|
"required": true
|
|
},
|
|
"slow_period": {
|
|
"type": "int",
|
|
"description": "Slow EMA period for MACD calculation",
|
|
"min": 15,
|
|
"max": 50,
|
|
"default": 26,
|
|
"required": true
|
|
},
|
|
"signal_period": {
|
|
"type": "int",
|
|
"description": "Signal line EMA period",
|
|
"min": 5,
|
|
"max": 20,
|
|
"default": 9,
|
|
"required": true
|
|
},
|
|
"signal_type": {
|
|
"type": "str",
|
|
"description": "Type of MACD signal to use",
|
|
"options": ["line_cross", "zero_cross", "histogram"],
|
|
"default": "line_cross",
|
|
"required": true
|
|
},
|
|
"histogram_threshold": {
|
|
"type": "float",
|
|
"description": "Minimum histogram value for signal confirmation",
|
|
"min": 0.0,
|
|
"max": 1.0,
|
|
"default": 0.0,
|
|
"required": false
|
|
}
|
|
},
|
|
"default_parameters": {
|
|
"fast_period": 12,
|
|
"slow_period": 26,
|
|
"signal_period": 9,
|
|
"signal_type": "line_cross",
|
|
"histogram_threshold": 0.0
|
|
},
|
|
"metadata": {
|
|
"required_indicators": ["macd"],
|
|
"timeframes": ["1h", "4h", "1d"],
|
|
"market_conditions": ["trending", "volatile"],
|
|
"risk_level": "medium",
|
|
"difficulty": "intermediate",
|
|
"signals": {
|
|
"buy": "MACD line crosses above signal line (or zero line)",
|
|
"sell": "MACD line crosses below signal line (or zero line)",
|
|
"confirmation": "Histogram supports signal direction"
|
|
},
|
|
"performance_notes": "Effective in trending markets but may lag during rapid price changes"
|
|
},
|
|
"validation_rules": {
|
|
"fast_period_less_than_slow": {
|
|
"rule": "fast_period < slow_period",
|
|
"message": "Fast period must be less than slow period"
|
|
},
|
|
"valid_signal_type": {
|
|
"rule": "signal_type in ['line_cross', 'zero_cross', 'histogram']",
|
|
"message": "Signal type must be one of: line_cross, zero_cross, histogram"
|
|
}
|
|
}
|
|
} |