Self-Evolving Capital Intelligence System — A professional-grade algorithmic trading framework with Bayesian edge estimation, adaptive risk management, and real-time MT5 integration.
Singularity Capital OS is an advanced trading intelligence system that combines:
- Bayesian Edge Estimation — Confidence-weighted win rate and expectancy calculations
- Monte Carlo Simulation — Risk-of-ruin and drawdown probability analysis
- Regime Detection — Adaptive market state identification (Trend/Chop/Panic)
- Dynamic Risk Management — Kelly Criterion with regime and drawdown adjustments
- Kill Switch Protection — Automatic trading halt on adverse conditions
- Multi-Agent Portfolio — Genetic algorithm-optimized agent allocation
- MT5 Real-Time Data — Live market prices and trade execution
┌────────────────────────────────────────────────────────────────────┐
│ ⚡ SINGULARITY CAPITAL OS 14:35:00 ● MT5 OK │
├────────────┬─────────────────────────────────┬─────────────────────┤
│ MT5 CONN │ XAUUSD EURUSD GBPUSD │ [TRADING SIGNALS] │
│ Balance: │ 2650.15 1.0852 1.2701 │ ✅ CLEAR TO TRADE │
│ $10,000 │ ▲ +15 ▼ -2 = 0 │ Risk: 0.45% │
│ │ │ │
│ [ANALYZE] │ Win Rate: 52.3% │ [SYSTEM TERMINAL] │
│ │ Edge: 0.32R │ > Analysis done │
└────────────┴─────────────────────────────────┴─────────────────────┘
│ 01アイウエオカキクケコサシス... v1.0.0 HACKER EDITION │
└────────────────────────────────────────────────────────────────────┘
# Clone the repository
git clone https://github.com/yourusername/singularity-capital-os.git
cd singularity-capital-os
# Install dependencies automatically
python launcher.py --installpip install -r requirements.txtpip install .
# Then run from anywhere:
singularitypython singularity_gui.pypython launcher.pypython launcher.py --gui # Launch Hacker GUI directly
python launcher.py --demo # Run demo mode
python launcher.py --backtest # Run backtest mode
python launcher.py --install # Install dependencies onlySingularity Capital OS/
├── 🖥️ singularity_gui.py # Hacker-themed GUI with MT5 integration
├── 🔌 mt5_connector.py # MetaTrader 5 real-time data connector
├── 🧠 singularity_core.py # Core analysis engine
├── 🧬 multi_agent_system.py # Multi-agent portfolio optimizer
├── 📊 Complete_Trading_System.py # CLI trading system
├── 💎 xauusd_agent.py # XAUUSD specialized agent
├── 🚀 launcher.py # Unified launcher with menu
├── 📋 requirements.txt # Python dependencies
├── ⚙️ setup.py # Package installer
└── 📈 singularity_multi.pine # Pine Script (TradingView)
Calculates win rate and expectancy with confidence bounds using Beta distribution:
from singularity_core import BayesianEdge
edge = BayesianEdge()
results = edge.update(returns_array)
print(f"Win Rate: {results['win_rate_mean']:.1%}")
print(f"Edge (Lower Bound): {results['expectancy_lb']:.4f}R")Simulates 10,000 equity curves to estimate:
- Maximum drawdown (95th percentile)
- Longest losing streak
- Risk of ruin probability
Identifies market states based on rolling volatility:
- Regime 0 — Low volatility (Trend)
- Regime 1 — Normal volatility (Chop)
- Regime 2 — High volatility (Panic)
Adjusts position sizing using:
- Half-Kelly criterion
- Regime-based multipliers
- Drawdown protection factor
Automatically halts trading when:
- 20%+ drawdown detected
- Losing streak exceeds threshold
- Negative edge detected
| Feature | Description |
|---|---|
| Real-time Prices | Bid/Ask with spread |
| Historical Data | OHLCV for any timeframe |
| Account Info | Balance, equity, margin, leverage |
| Trade Execution | Buy/Sell with SL/TP |
| Symbol Info | Contract specs, spreads |
| Simulation Mode | Works without MT5 installed |
from mt5_connector import get_connector
connector = get_connector()
success, message = connector.connect()
# Get real-time price
price = connector.get_current_price("XAUUSD")
print(f"XAUUSD: {price['bid']}")
# Get historical data
df = connector.get_historical_data("EURUSD", "M15", 500)| Code | Timeframe |
|---|---|
| M1 | 1 Minute |
| M5 | 5 Minutes |
| M15 | 15 Minutes |
| M30 | 30 Minutes |
| H1 | 1 Hour |
| H4 | 4 Hours |
| D1 | Daily |
| W1 | Weekly |
The genetic algorithm optimizes agent allocation across markets:
from multi_agent_system import EvolutionEngine, PortfolioAllocator
# Initialize agents for multiple symbols
symbols = ['XAUUSD', 'EURUSD', 'GBPUSD', 'USDJPY']
engine = EvolutionEngine(symbols)
# Evolve for 50 generations
best_agents = engine.evolve(generations=50)
# Get optimized allocations
allocator = PortfolioAllocator(best_agents)
allocations = allocator.get_allocations()# In singularity_core.py
core = SingularityCore(
base_risk=0.01, # 1% base risk per trade
max_drawdown=0.20, # 20% max drawdown trigger
kelly_fraction=0.5, # Half-Kelly sizing
)- Auto Refresh — Automatically update prices
- Sound Alerts — Audio notifications for signals
- Python 3.8+
- numpy >= 1.21.0
- pandas >= 1.3.0
- scipy >= 1.7.0
- customtkinter >= 5.0.0
- MetaTrader5 (optional, for live data)
- Ensure MT5 terminal is running
- Enable "Allow DLL imports" in MT5 settings
- Try closing and reopening MT5
python launcher.py --installpip install customtkinter --upgradeMIT License — see LICENSE for details.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
- Author: Singularity Trading Systems
- Email: support@singularity-capital.com
- GitHub: github.com/singularity-capital
This software is for educational and research purposes only. Trading financial instruments involves substantial risk of loss and is not suitable for every investor. Past performance is not indicative of future results. The developers are not responsible for any financial losses incurred from using this software.
⚡ SINGULARITY CAPITAL OS ⚡
Self-Evolving Capital Intelligence