Algorithmic Trading
Open-source trading tools (MQL5 & NinjaTrader) + DeFi crypto bot + AlgoSphere Quant showcase
Install / Use
npx skills add e49nana/Algorithmic-tradingInstalls into whichever agent you are using.
README
Open-source tools & strategies for algorithmic trading — from traditional markets to DeFi.
Commercial products by AlgoSphere Quant are listed below but hosted on the MQL5 Marketplace.
📖 About
This repository brings together my algorithmic trading work across two worlds:
| | TradFi | DeFi | |---|---|---| | Platforms | MetaTrader 5, NinjaTrader | Ethereum, Arbitrum, Polygon, Solana | | Languages | MQL5, C# | Python, Solidity (learning) | | Focus | Indicators, EAs, position management | CEX/DEX connectors, arbitrage, MEV | | Status | Mature (14+ products) | Active development |
🛢️ Spotlight — Djibril AI
My most advanced open-source system: AI-powered crude oil trading based on real-time geopolitical analysis.
Claude API scores Iran/Middle East tensions (-10 to +10), a composite engine blends geo + technical + sentiment signals, Kelly sizing computes position size, and a MetaTrader 5 EA executes WTI/Brent trades — with a real-time React dashboard on top.
FastAPI · React/TypeScript · MQL5 · Docker · 98 tests
📂 Repository Structure
Algorithmic-Trading/
│
├── tradfi/
│ ├── mql5/
│ │ ├── libraries/
│ │ │ ├── SessionTimeFilter.mqh
│ │ │ └── PositionSizer.mqh
│ │ ├── indicators/
│ │ │ ├── SpreadAnalyzer.mq5
│ │ │ ├── CandlePatternDetector.mq5
│ │ │ └── MultiTimeframeDashboard.mq5
│ │ ├── experts/
│ │ │ ├── DrawdownGuard.mq5
│ │ │ └── TradeStatistics.mq5
│ │ └── scripts/
│ │ ├── RiskCalculator.mq5
│ │ └── TradeJournal.mq5
│ │
│ └── ninjatrader/
│ ├── indicators/
│ │ ├── VolumeProfile.cs
│ │ ├── OrderFlowImbalance.cs
│ │ └── SessionHighLow.cs
│ └── strategies/
│ └── snippets/
│
├── defi/
│ ├── crypto-trade-bot/
│ │ ├── connectors/
│ │ │ ├── cex/ # CEX connectors (Binance, Bybit, OKX)
│ │ │ │ ├── base.py
│ │ │ │ ├── binance.py
│ │ │ │ ├── bybit.py
│ │ │ │ └── okx.py
│ │ │ └── dex/ # DEX connectors
│ │ │ ├── base.py # AbstractDEXConnector
│ │ │ └── uniswap.py # Uniswap V3 (Web3.py)
│ │ ├── services/
│ │ │ └── exchange_rate_limiter.py # Token bucket rate limiting
│ │ ├── config/
│ │ └── tests/ # 294 tests, 0 failures
│ │
│ └── contracts/ # Solidity (coming soon)
│ └── README.md
│
└── docs/
├── architecture.md
└── defi-roadmap.md
💹 TradFi — MetaTrader 5 & NinjaTrader
MQL5 — Open-Source Tools
| Tool | Description | Type | |------|-------------|------| | SessionTimeFilter | Filter trades by session (London, NY, Tokyo, Sydney) with overlap detection | Library | | PositionSizer | Risk-based position sizing — fixed lot, percent risk, Kelly criterion | Library | | SpreadAnalyzer | Real-time spread monitoring with statistics (avg, max, percentile) | Indicator | | CandlePatternDetector | Automated detection of 15+ candlestick patterns with alerts | Indicator | | MultiTimeframeDashboard | Multi-timeframe trend direction panel (RSI, MA, ADX) | Indicator | | DrawdownGuard | Automated equity protection with daily/weekly drawdown limits | Expert | | TradeStatistics | Real-time win rate, expectancy, profit factor, Sharpe ratio | Expert | | RiskCalculator | One-click lot size calculator based on SL distance & risk % | Script | | TradeJournal | Export complete trade history to CSV for external analysis | Script |
All MQL5 tools are also available on the MQL5 Code Base.
NinjaTrader — C# Indicators
| Indicator | Description | Market | |-----------|-------------|--------| | VolumeProfile | Volume distribution at each price level, VAH/VAL/POC | Futures | | OrderFlowImbalance | Bid/Ask imbalance detection for scalping | Futures | | SessionHighLow | Automatic session (RTH/ETH) high/low/mid levels | Futures |
⛓️ DeFi — Crypto Trading Bot
Multi-exchange, multi-chain trading bot with CEX and DEX support, built in Python with async architecture.
Architecture
┌──────────────────────────────────────────────────────────────┐
│ Telegram Bot Interface │
├──────────────────────────────────────────────────────────────┤
│ Strategy Engine │
├────────────────────┬─────────────────────────────────────────┤
│ CEX Connectors │ DEX Connectors │
│ ┌───────────────┐ │ ┌────────────────────────────────────┐ │
│ │ Binance │ │ │ Uniswap V3 (Web3.py) │ │
│ │ Bybit │ │ │ ├─ Ethereum mainnet │ │
│ │ OKX │ │ │ ├─ Arbitrum │ │
│ └───────┬───────┘ │ │ └─ Polygon │ │
│ │ │ └────────────────────────────────────┘ │
│ ▼ │ │
│ ┌───────────────┐ │ Smart Contracts │
│ │ Rate Limiter │ │ ┌────────────────────────────────────┐ │
│ │ Token Bucket │ │ │ Quoter V2 (price quotes) │ │
│ │ per-exchange │ │ │ SwapRouter02 (execute swaps) │ │
│ │ per-endpoint │ │ │ ERC-20 (approve/balance) │ │
│ └───────────────┘ │ └────────────────────────────────────┘ │
├────────────────────┴─────────────────────────────────────────┤
│ Config │ Logging │ 294 Tests │
└──────────────────────────────────────────────────────────────┘
Key Features
- 3 CEX connectors — Binance, Bybit, OKX via ccxt (async)
- Uniswap V3 DEX connector — Direct smart contract interaction via Web3.py (Quoter V2, SwapRouter02)
- Multi-chain — Ethereum mainnet, Arbitrum, Polygon
- Token bucket rate limiter — Per-exchange, per-endpoint (order/market_data/account), with 10-20% headroom below real limits
- Async-first —
aiogramfor Telegram,asyncio.to_thread()for sync ccxt calls - 294 tests, 0 failures
Rate Limiter — Exchange Limits
| Exchange | Global | Orders | Market Data | Account | |----------|:------:|:------:|:-----------:|:-------:| | Binance | 1000/min | 400/min | 800/min | 400/min | | Bybit | 5000/min | 500/min | 2000/min | 600/min | | OKX | 2000/min | 500/min | 1200/min | 500/min |
🔗 Blockchain & Smart Contracts (Roadmap)
Currently learning Solidity and smart contract development. Planned projects:
| Phase | Project | Stack | Status | |:-----:|---------|-------|:------:| | 1 | Solidity fundamentals + first contract deployment | Solidity, Remix, Hardhat | 📋 Planned | | 2 | DEX mechanics — study Uniswap V2/V3 source code | Solidity, Foundry | 📋 Planned | | 3 | Flashloan arbitrage bot | Solidity, Aave V3, Foundry | 📋 Planned | | 4 | MEV extraction (backrunning, sandwich detection) | Solidity, Flashbots | 📋 Planned | | 5 | Smart contract security auditing | Slither, Mythril, CTFs | 📋 Planned |
Learning resources in progress: CryptoZombies, Ethernaut, Damn Vulnerable DeFi
🏢 AlgoSphere Quant — Commercial Products
Source code is private — links point to the MQL5 Marketplace.
🏆 Flagship Products
| Product | Description | Version | |---------|-------------|:-------:| | Trade Manager PRO | Position management — automated BE, trailing, partial closes, TP ladders, session filter, journal export | v7.10 | | SafeScalperPro | Automated scalping EA with risk management and prop firm compliance | v3.0 |
Product Suite (14 products)
<details> <summary><b>📈 9 Indicators + 🛡️ 5 Utilities</b> (click to expand)</summary>Indicators: SmartMoney Concepts, Liquidity Heatmap, Volume Profile, Divergence Scanner, Order Flow, Correlation Matrix, Session Control, Account Analytics, Risk Manager
Utilities: PropGuard (prop firm compliance), Risk Manager (drawdown protection), Trade Journal, Position Sizer, News Filter
All products feature the unified ASQ Dark Theme built on shared includes (ASQ_Theme.mqh, ASQ_Common.mqh).
🏗️ Architecture Philosophy
┌─────────────────────────────────────────────────────┐
│ EA / Bot / DApp │
├─────────────────────────────────────────────────────┤
│ ┌──────────┐ ┌──────────┐ ┌───────────────────┐ │
│ │ Signal │ │ Filter │ │ Risk Management │ │
│ │ Module │ │ Module
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
python-debugpy
385.5kDebug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
skill-creator
385.5kCreate, edit, audit, tidy, validate, or restructure AgentSkills and SKILL.md files.
claude-opus-4-5-migration
140.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
