Cortex is a next-generation automated trading system that combines high-frequency signal processing with a Retrieval-Augmented Generation (RAG) AI brain to make informed, context-aware trading decisions.
Unlike traditional bots that rely solely on math, Cortex has a Memory.
- ChromaDB: Stores past trading scenarios, market setups, and outcomes ("Playbooks").
- Ollama (LLM): Analyzes current ML signals against this historical context to detect hallucinations or weak setups.
- RAG Process:
- Retrieve: Finds similar past market conditions.
- Augment: Feeds current technicals + past outcomes to the AI.
- Generate: AI outputs a "Confidence Score" and reasoning (Buy/Sell/Hold).
A modern, dark-mode UI built with Flask and Server-Sent Events (SSE).
- Real-Time Ticker: Live price updates without page reloads.
- Active Trade Management: visual stop-loss/take-profit tracking.
- System Health: Monitor AI inference latency and bridge connection status.
- Hybrid Signal Generation: Combines classic ML (TensorFlow/Scikit-Learn) with "Intelligent Indicators".
- Safety First: "Live Guard" prevents execution if MT5 connection is unstable.
- Auto-Risk: Dynamic position sizing based on account equity and volatility (ATR).
graph TD
A[MT5/Binance] -->|Live Data| B(Real-time Service)
B --> C{ML Engine}
C -->|Raw Signal| D[RAG Evaluator]
D <-->|Query/Context| E[(ChromaDB Memory)]
D <-->|Inference| F[Ollama AI]
D -->|Validated Signal| G[Execution Engine]
G --> A
B --> H["Web Dashboard (Flask)"]
G --> H
-
Clone & Install Dependencies:
pip install -r requirements.txt
-
Configure Credentials:
- Copy
config.example.jsontoconfig.json. - Enter your MT5 and Telegram credentials. (See
SETUP_GUIDE.mdfor details).
- Copy
-
Run the System:
The system requires two separate terminals:
Terminal 1: MT5 Bridge (Must run first!)
cd mt5-bridge py main.pyTerminal 2: Core System
py run.py
Access the UI at:
http://127.0.0.1:5000
The system handles offline model training via the scripts/ module.
python -m scripts.train -c config.json
- Frontend:
app/templates(HTML/Tailwind) - AI Logic:
service/ai_agent.py - Trading Core:
service/server.py
