Automated NNFX Strategy Discovery & Backtesting System
A systematic approach to discovering and validating profitable trading strategies using the No Nonsense Forex (NNFX) methodology. Automates the full pipeline from indicator screening to portfolio backtesting.
📊 Strategy Discovery - Screen 40+ indicators for edge across multiple timeframes
🧪 Backtesting - Full position engine with money management rules
📈 Portfolio Optimization - Combine strategies with correlation analysis
🤖 AI Analysis - Claude-powered strategy interpretation and reporting
``` ┌─────────────────────────────────────────────────────────────┐ │ Discovery Pipeline │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Stage 1 │ → │ Stage 2 │ → │ Stage 3 │ → │ Stage 4 │ │ │ │Indicator │ │Baseline │ │Confirm │ │Portfolio │ │ │ │Screening │ │ Entry │ │ Exit │ │ Building │ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │ ↓ ↓ ↓ ↓ │ │ [40+ indicators] [Entry signals] [Exit rules] [Correlation]│ └─────────────────────────────────────────────────────────────┘ │ ↓ ┌─────────────────────────────────────────────────────────────┐ │ Backtesting Engine │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │ │Position Engine│ │Risk Manager │ │ Performance Stats│ │ │ │• Entry/Exit │ │• Position │ │• Win rate │ │ │ │• Stop Loss │ │ sizing │ │• Profit factor │ │ │ │• Take Profit │ │• Exposure │ │• Drawdown │ │ │ └──────────────┘ └──────────────┘ └──────────────────┘ │ └─────────────────────────────────────────────────────────────┘ │ ↓ ┌─────────────────────────────────────────────────────────────┐ │ AI Analysis Layer │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ Claude API → Strategy interpretation & reporting │ │ │ └──────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘ ```
| Layer | Technology |
|---|---|
| Language | Python 3.10+ |
| Trading Platform | MetaTrader 5 (MT5) |
| Data | MT5 API, Pandas, NumPy |
| Indicators | 42 Python-native implementations |
| Backtesting | Custom position engine |
| AI | Anthropic Claude API |
| Visualization | Streamlit dashboard |
```bash
git clone https://github.com/13otKmdr/MT5-AlgoLab.git cd MT5-AlgoLab
pip install -r requirements.txt
python DiscoveryEngine/health_check.py
python execution/run_discovery.py --category crypto --timeframe H1 ```
Full implementation of the No Nonsense Forex approach:
- Indicator screening with robustness testing
- Baseline entry signal validation
- Confirmation indicator pairing
- Exit strategy optimization
Python implementations of popular indicators:
- Trend: EMA, SMA, Hull MA, Ichimoku
- Momentum: RSI, CCI, MACD, Stochastic
- Volatility: ATR, Bollinger, Keltner
- Volume: OBV, VWAP
- Position-level simulation
- Stop loss and take profit
- Money management rules
- Currency exposure limits
- Performance metrics (Sharpe, drawdown, win rate)
Claude interprets backtest results and generates:
- Strategy summaries
- Trade rationale explanations
- Risk assessments
- Portfolio recommendations
- Real-time discovery progress
- Backtest visualizations
- Equity curves
- Trade statistics
``` MT5-AlgoLab/ ├── DiscoveryEngine/ # NNFX discovery pipeline │ ├── bridge/ # MT5 terminal communication │ ├── logic/ # NNFX validation rules │ └── config/ # Discovery configurations ├── StrategyFactory/ # Deep backtesting │ ├── backtesting/ # Position engine │ ├── strategies/ # Strategy implementations │ └── risk/ # Exposure management ├── execution/ # Orchestration scripts │ ├── indicators_library.py # 42 indicators │ └── run_discovery.py # Main pipeline ├── dashboard/ # Streamlit UI ├── database/ # Results storage └── output/ # Generated reports ```
Systematic Trading Research: Implementing a rigorous, repeatable process for strategy discovery rather than discretionary trading.
Python + MT5 Integration: Building a bridge between Python's data science ecosystem and MetaTrader's trading capabilities.
Position-Level Backtesting: Creating a realistic backtesting engine that accounts for position sizing, exposure limits, and money management rules.
AI-Assisted Analysis: Using LLMs to interpret quantitative results and generate human-readable strategy reports.
Large-Scale Parameter Optimization: Running thousands of indicator combinations efficiently with proper statistical validation.
- Python 3.10+
- MetaTrader 5 terminal (running)
- Anthropic API key (for AI analysis)
- Windows (for MT5 integration) or Wine on Linux
MIT
Automated NNFX strategy discovery and backtesting