8000
Skip to content

13otKmdr/MT5-AlgoLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

654 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MT5-AlgoLab

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.

Python MetaTrader 5 AI


What It Does

πŸ“Š 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


Architecture

``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 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 β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ```


Tech Stack

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

Quick Start

```bash

Clone

git clone https://github.com/13otKmdr/MT5-AlgoLab.git cd MT5-AlgoLab

Install

pip install -r requirements.txt

Verify MT5 connection (terminal must be running)

python DiscoveryEngine/health_check.py

Run discovery

python execution/run_discovery.py --category crypto --timeframe H1 ```


Key Features

NNFX Methodology Implementation

Full implementation of the No Nonsense Forex approach:

  • Indicator screening with robustness testing
  • Baseline entry signal validation
  • Confirmation indicator pairing
  • Exit strategy optimization

42 Native Indicators

Python implementations of popular indicators:

  • Trend: EMA, SMA, Hull MA, Ichimoku
  • Momentum: RSI, CCI, MACD, Stochastic
  • Volatility: ATR, Bollinger, Keltner
  • Volume: OBV, VWAP

Full Backtesting Engine

  • Position-level simulation
  • Stop loss and take profit
  • Money management rules
  • Currency exposure limits
  • Performance metrics (Sharpe, drawdown, win rate)

AI-Powered Analysis

Claude interprets backtest results and generates:

  • Strategy summaries
  • Trade rationale explanations
  • Risk assessments
  • Portfolio recommendations

Streamlit Dashboard

  • Real-time discovery progress
  • Backtest visualizations
  • Equity curves
  • Trade statistics

Project Structure

``` 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 ```


What I Learned Building This

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.


Requirements

  • Python 3.10+
  • MetaTrader 5 terminal (running)
  • Anthropic API key (for AI analysis)
  • Windows (for MT5 integration) or Wine on Linux

License

MIT


Automated NNFX strategy discovery and backtesting

About

Automated NNFX Strategy Discovery & Backtesting System for MetaTrader 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

0