Skip to content

langatdex/Algo-Trading

Repository files navigation

Algo-Trading

A comprehensive algorithmic trading repository combining MQL5 Expert Advisors for MetaTrader 5 and Python-based quantitative trading strategies with machine learning capabilities.

📁 Repository Structure

Algo-Trading/
├── MQL5-Expert-Advisors/     # MetaTrader 5 Expert Advisors and Indicators
│   ├── 1_Expert_Advisors_EA/  # Trading strategy EAs
│   ├── 2_Indicators_EA/       # Custom technical indicators
│   ├── 3_MQL5_EA_Tools/      # Utility tools and helpers
│   └── 4_Neural_Networks/     # Neural network-based EAs
├── Python-Quantitative-Trading/  # Python quantitative analysis and ML
│   ├── Machine_Learning/      # Neural network implementations
│   └── Notebooks/              # Jupyter notebooks for research
└── XAUUSD-AI-Trading-Assistant/  # AI-powered Gold trading bot
    ├── XAUSD_AI.py            # Core trading bot with Groq LLM
    ├── app.py                  # Streamlit web dashboard
    └── .streamlit/             # Configuration files

🚀 MQL5 Expert Advisors

Features

  • 18+ Expert Advisors implementing various trading strategies
  • Multiple Indicators including SuperTrend, TSI, and custom oscillators
  • Neural Network EAs using Wavelet Neural Networks (WNN)
  • Risk Management Tools with trailing stops, lot size calculators, and position management
  • News Filtering to avoid trading during high-impact economic events
  • Multi-Asset Support for Forex, Crypto, Gold, and US Indices

Expert Advisors Included

  • RSI-based strategies (RSI_V1, RSI_V2, RSI_MA)
  • Moving Average strategies (MA_V1, Triple_MA)
  • Bollinger Bands EA
  • TSI (True Strength Index) variants
  • Volatility Navigator
  • HFS_NS92 Scalping EA with news filtering
  • Neural Network EA (R2WM)

Installation

  1. Copy the MQL5-Expert-Advisors folder contents to your MetaTrader 5 data directory:
    • Experts: C:\Users\[YourName]\AppData\Roaming\MetaQuotes\Terminal\[TerminalID]\MQL5\Experts\
    • Indicators: C:\Users\[YourName]\AppData\Roaming\MetaQuotes\Terminal\[TerminalID]\MQL5\Indicators\
    • Include: Copy WNN.mqh to MQL5\Include\
  2. Open MetaTrader 5 and press F4 to open MetaEditor
  3. Compile the .mq5 files (or use pre-compiled .ex5 files)
  4. Refresh the Navigator (Ctrl+N) and drag EAs onto charts

Usage

  • Enable "Algo Trading" button in MT5
  • Right-click an EA in Navigator → Test for backtesting
  • Configure parameters in EA settings before attaching to chart
  • ⚠️ Always test on demo account first!

🤖 XAUUSD AI Trading Assistant

Features

  • AI-Powered Analysis: Uses Groq LLM for intelligent trade signal generation
  • Multi-Timeframe Analysis: D1, H4, H1, M30, M15, M5 timeframes
  • Real-Time MT5 Integration: Direct connection to MetaTrader 5
  • Interactive Dashboard: Streamlit web interface for monitoring
  • Technical Indicators: RSI, EMA, ATR calculations
  • Risk Management: ATR-based stop losses with 1% risk per trade

Installation

  1. Install dependencies:
cd XAUUSD-AI-Trading-Assistant
pip install -r requirements.txt
  1. Get Groq API key from: https://console.groq.com/

  2. Configure API key:

    • Copy .streamlit/secrets.toml.example to .streamlit/secrets.toml
    • Add your API key: GROQ_API_KEY = "your-key-here"
  3. Ensure MetaTrader 5 is running and logged in

  4. Run the dashboard:

streamlit run app.py

Usage

  • Open the web dashboard (usually at http://localhost:8501)
  • Click "Run New Analysis" to get AI-powered trading signals
  • Enable auto-refresh for continuous monitoring (updates every 30 minutes)
  • Review multi-timeframe analysis and trading recommendations

Note: Always test on demo account first and verify all signals before trading!

🐍 Python Quantitative Trading

Features

  • Machine Learning Models: Neural Networks, LSTM, Bayesian Neural Networks
  • Quantitative Analysis: Volatility computation, Sharpe Ratio, Sortino Ratio, Z-Score
  • Pairs Trading: Statistical arbitrage strategies
  • Data Management: SQLite integration for market data storage
  • Jupyter Notebooks: Interactive research and backtesting environment

Installation

Using Conda (Recommended)

conda env create -f Python-Quantitative-Trading/environment.yml
conda activate VS-QTrading
pip install -e Python-Quantitative-Trading/

Using pip

cd Python-Quantitative-Trading
pip install -e .

Dependencies

  • pandas >= 2.0
  • numpy >= 1.24
  • scipy >= 1.10
  • backtrader >= 1.9
  • yfinance >= 0.2
  • TensorFlow/Keras (for neural networks)
  • Jupyter (for notebooks)

Usage

  1. Activate the environment: conda activate VS-QTrading
  2. Launch Jupyter: jupyter notebook
  3. Open notebooks from the Notebooks/ directory
  4. Run backtests: python src/backtest.py (if src/ directory exists)

📊 Notebooks Overview

  • 00_Test.ipynb: Initial testing and setup
  • 01_Research.ipynb: Market research and data exploration
  • 02_Pairs_Trading.ipynb: Statistical arbitrage strategies
  • 03_Compute_Volatility.ipynb: Volatility analysis
  • 04_Sharpe_Ratio.ipynb: Risk-adjusted returns
  • 05_ZScore.ipynb: Statistical normalization
  • 06_GBM.ipynb: Geometric Brownian Motion modeling
  • 07_Sortino_Ratio.ipynb: Downside risk metrics
  • 08_SQLite.ipynb: Database operations
  • 09_LSTM.ipynb: Long Short-Term Memory networks
  • 10_NN_Keras.ipynb: Keras neural networks
  • 11_NN_TF_Keras.ipynb: TensorFlow/Keras implementations
  • 12_BNN.ipynb: Bayesian Neural Networks

⚠️ Disclaimer

This software is for educational and research purposes only. Trading involves substantial risk of loss. Past performance does not guarantee future results. Always:

  • Test strategies thoroughly on demo accounts
  • Understand the risks before live trading
  • Never risk more than you can afford to lose
  • Consider consulting with a financial advisor

📝 License

See individual LICENSE files in each project directory.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📧 Contact

For questions or support, please open an issue on GitHub.


Happy Trading! 📈

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published