Cortex AI Quant Mascot
ZERO DLL IMPORTS Hurst = 0.65 · Strong Trend 📈

The Institutional Execution Desk & On-Device Quant AI for MetaTrader.

Trade a single chart with sub-millisecond risk precision, allocate across 10+ prop and personal terminals like a hedge fund manager, and harness deterministic PhD quant regime telemetry—100% locally on your desktop.

🛡️ Windows Unsigned Beta · SmartScreen: click "More info" → "Run anyway" · Active until Dec 31, 2026
Zero-DLL Kernel Named Pipe Native MQL4/MQL5 FileOpen sandbox (`AllowDllImport = 0`). Safe for strict prop firms.
1 → N Multi-Terminal Fund Manager Pro-Rata Equity %, Equal $, or Quarter-Kelly allocation across MT4 & MT5 simultaneously.
On-Device PhD Quant Engine Hurst exponent, Yang-Zhang volatility, Quarter-Kelly sizing & 95% 1-Day Parametric VaR.
MCP Server & Local REST API Connect Claude Code, Cursor, or Python agents with human-in-the-loop approval cards.
Cortex AI — Companion Ticket (480×820) ● PIPE LIVE
EURUSD M15 · MT5 · Pepperstone #62145326
Demo
Balance
$5,000
Equity
$5,000
Floating
+$0.00
Symbol
1.08450
SL / TP1.08645 / 1.08045
Risk$50.00 (1.00%)
R:R2.00
SL / TP1.08255 / 1.08855
Risk$50.00 (1.00%)
R:R2.00
AI Quant Regime & Alpha Radar TREND BULL · BUY (78%)
Hurst (H)
0.64
ATR
14.0p
¼-Kelly
0.85%
Z-Score
+0.92σ
Rec: 0.85% risk · SL 21p · TP 46p · BE 14p
Order Ticket (Try editing live)
ON-DEVICE QUANTITATIVE INTELLIGENCE

Real Stochastic Calculus & Regime Detection. Not LLM Hype.

Every 5 seconds, the Cortex AI EA streams 120 closed OHLCV bars over the Named Pipe into an on-device quantitative regime & portfolio risk engine. Zero cloud latency, zero API key required.

1. Rescaled-Range (R/S) Hurst Exponent ($H$)

Measures multi-scale log-return memory across lag windows to separate persistent institutional order-flow from mean-reverting chop.

H > 0.55 → Persistent Trend | H < 0.45 → Mean Reversion | H ≈ 0.50 → Random Walk

2. Yang-Zhang Minimum-Variance OHLC Volatility

Combines overnight jump variance ($\sigma_o^2$), open-to-close drift ($\sigma_c^2$), and Rogers-Satchell intrabar extremes ($\sigma_{rs}^2$) for minimum-error volatility tracking.

σ²_YZ = σ²_overnight + k·σ²_open-close + (1 − k)·σ²_Rogers-Satchell

3. Fractional Quarter-Kelly Optimal Sizing

Translates regime directional probability ($p$) and ATR-derived payoff odds ($b = \text{TP}/\text{SL}$) into a damped Quarter-Kelly risk allocation bounded to $[0.25\%, 2.00\%]$.

f* = clamp( 0.25 × (p·b − (1 − p)) / b , 0.25% , 2.00% )

4. 95% 1-Day Parametric VaR & Stop-Locked Audit

Audits every open position across your account to compare stop-locked cash risk against 95% daily Value-at-Risk ($1.645 \cdot \sigma_{\text{daily}} \cdot \text{Notional}$).

VaR_95 = 1.64485 × (σ_YZ_annual / √252) × GrossExposureUSD
1 → N MULTI-TERMINAL FUND DESK

Manage Prop Evaluations & Personal Accounts as One Unified Fund.

Connect MT4 and MT5 terminals across different brokers simultaneously. Dispatch a single trade idea and let Cortex AI independently calculate lots, stops, and Risk Guard checks per terminal.

Pro-Rata Equity %

Risk the exact same percentage of equity on every terminal (e.g., 1.0% on a $100k FTMO account = $1,000 risk; 1.0% on a $5k personal account = $50 risk).

Quant Quarter-Kelly Scaling

Automatically size each terminal using its active symbol's Quarter-Kelly regime recommendation and broker tick value.

Emergency 1-Click Flatten All

Two-click global circuit breaker dispatches close_all across every connected MT4 and MT5 terminal simultaneously before major news events.

AI COPILOT & MODEL CONTEXT PROTOCOL

Built for Humans. Native to Autonomous AI Agents.

Connect Claude Code, Cursor, Claude Desktop, Antigravity, Windsurf, or custom Python scripts via Local HTTP MCP. Every agent trade flows through TradingHub, quantitative regime filters, and your personal Risk Guard.

Ready-Made Harness Setup Packs

Select your AI coding harness below for 1-click copy-paste connection config & system prompt.

ZERO-NPM · LOCAL HTTP MCP (PORT 17845)
Step 1 — Terminal Connection Command (Run once in terminal)
claude mcp add --transport http aims-cortex http://127.0.0.1:17845/mcp --header "Authorization: Bearer <YOUR_TOKEN>"
Step 1 — Add to .cursor/mcp.json or Cursor Settings → Features → MCP
{
  "mcpServers": {
    "aims-cortex": {
      "url": "http://127.0.0.1:17845/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}
Step 1 — Add to ~/.openclaw/config.json or run OpenClaw CLI
openclaw mcp add --name aims-cortex --url http://127.0.0.1:17845/mcp --header "Authorization: Bearer <YOUR_TOKEN>"
Step 1 — Add to hermes.json or run Hermes CLI
hermes tool add --name aims-cortex --mcp-http http://127.0.0.1:17845/mcp --token <YOUR_TOKEN>
Step 1 — xAI Grok Agent Integration Script (or use in-app AI Assistant tab)
import requests
from openai import OpenAI

# 1. Initialize xAI Grok (model grok-2-latest)
grok = OpenAI(api_key="xai_YOUR_KEY", base_url="https://api.x.ai/v1")
CORTEX_URL = "http://127.0.0.1:17845"
TOKEN = "<YOUR_TOKEN>"
headers = {"Authorization": f"Bearer {TOKEN}"}

# 2. Query Cortex for live state & quant signals
terminals = requests.get(f"{CORTEX_URL}/v1/tools/list_terminals", headers=headers).json()
session_id = terminals[0]["sessionId"]
signals = requests.post(f"{CORTEX_URL}/v1/tools/get_signals", headers=headers, json={"sessionId": session_id}).json()
print(f"Terminal: {session_id} | Hurst: {signals.get('signal', {}).get('hurst')}")
Step 1 — Add to %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "aims-cortex": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-proxy",
        "http://127.0.0.1:17845/mcp",
        "--headers",
        "Authorization=Bearer <YOUR_TOKEN>"
      ]
    }
  }
}
Step 1 — Add to Antigravity MCP Settings or mcp_config.json
{
  "mcpServers": {
    "aims-cortex": {
      "url": "http://127.0.0.1:17845/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}
Step 1 — Add to ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "aims-cortex": {
      "serverUrl": "http://127.0.0.1:17845/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}
Step 1 — Direct Python / REST Loopback Script
import requests

CORTEX_URL = "http://127.0.0.1:17845"
TOKEN = "<YOUR_TOKEN>"
HEADERS = {"Authorization": f"Bearer {TOKEN}"}

# List terminals
terminals = requests.get(f"{CORTEX_URL}/v1/tools/list_terminals", headers=HEADERS).json()
print("Terminals:", terminals)

# Preview order
session_id = terminals[0]["sessionId"]
preview = requests.post(f"{CORTEX_URL}/v1/orders/preview", headers=HEADERS, json={
    "sessionId": session_id,
    "side": "buy",
    "type": "market",
    "sizing": {"mode": "risk_percent", "riskPercent": 1.0},
    "stop": {"mode": "pips", "pips": 25.0}
}).json()
print("Preview:", preview)
Step 2 — Copy & Paste Agent Bootstrap System Prompt (Paste into .cursorrules, CLAUDE.md, or system prompt)
You are an autonomous quantitative execution assistant connected to MetaTrader 4/5 via Cortex AI over MCP.

Immutable operational trading rules:
1. MANDATORY READ-BEFORE-WRITE:
   - Call list_terminals and get_market(sessionId) before taking or proposing any trade.
   - Call get_signals(sessionId) or inspect_chart(sessionId, symbol, timeframe) to verify statistical regime (Hurst exponent, Variance Ratio, Efficiency Ratio, ATR friction). Reject entry if spread exceeds 20% of ATR.

2. MANDATORY PRE-TRADE VALIDATION (PREVIEW FIRST):
   - You MUST call preview_order before place_order. Inspect the returned OrderPlan (lots, cashAtRisk, riskPercent, stopLossPrice) and ensure ok === true with zero Risk Guard violations.

3. HARD RISK CONSTRAINTS:
   - Every order MUST have a non-zero stop loss. Zero-stop trades are prohibited.
   - Risk sizing must respect riskPercent (default 1.0% max) or Quarter-Kelly recommendation.
   - Stop trading immediately if daily drawdown limit is reached.

4. STRUCTURED TRADE EXPLANATION:
   Always state: Terminal & Symbol, Order Intent, Statistical Edge (Hurst / AIMS Box / ATR), and Risk & Sizing before executing.

5. POSITION MANAGEMENT:
   - Call get_positions to monitor open risk.
   - Use manage_position to move stops to break-even or scale out when targets hit.

Human-in-the-Loop Approval Gate

Tokens with requireApproval = true pause execution and surface an interactive Approve / Reject card at the top of Cortex AI with a 5-minute auto-expiry.

Agent Request → PlanOrder → RiskGuard → ApprovalBar → EA Pipe

Single Source of Truth Tool Catalogue

One unified schema defines 11+ quantitative tools for MCP, REST, and the in-app AI assistant, ensuring 100% feature parity across any model.

list_terminals · inspect_chart · get_signals · preview_order
Cortex AI Mascot INSTANT ACCESS · 2-MINUTE ACTIVATION

Get Your 30-Day Free Trial License Key

No credit card required. Receive a cryptographically signed Ed25519 license token immediately on screen. Valid across 2 personal or VPS machines with 14-day offline grace.

✓ 30-Day License Token Generated:

Paste into Cortex AI Settings → License Key → Activate.

What's Included in Beta

  • Full access to Order Ticket & Risk Guard
  • Quant Regime Conviction Radar (Hurst, VR, ER)
  • Multi-Terminal Fund Manager (MT4 + MT5)
  • MCP Server for Claude Code & Cursor agents
  • Emergency position close never blocked
  • Free community support
OFFICIAL RELEASES

Download Cortex AI

Production-grade Windows execution workstation. Bundles compiled zero-DLL AIMSCortex.ex4 and AIMSCortex.ex5.

RECOMMENDED

Windows Setup (.exe)

Single-click setup targeting %LOCALAPPDATA%. No admin UAC elevation prompts required. Auto-creates desktop & Start Menu shortcuts.

v0.9.0-beta.1 (x64) · 119 MB
SHA256: dc157aeafde43df78481ac6febc1...
Download Setup (.exe) ↓
DISCORD / TESTERS

Beta Tester Kit (.zip)

Complete tester bundle containing the installer, Markdown quick-start instructions, text guide, and official SHA256 checksums.

v0.9.0-beta.1 (Kit) · 119 MB
SHA256: 369fe869f028eb7c46af38b735bd...
Download Tester Kit (.zip) ↓
PORTABLE / VPS

Portable Package (.zip)

Standalone unpacked distribution for external SSDs, locked VPS environments, or running without Windows registry integration.

v0.9.0-beta.1 (Portable) · 151 MB
SHA256: b2432e402ae1df3ae51a4fa9eda8...
Download Portable (.zip) ↓
GETTING STARTED

1. Quickstart & Zero-DLL Setup

Cortex AI connects to MetaTrader 4 and MetaTrader 5 over a native Windows Named Pipe (\\.\pipe\Cortex.AI.v2) using MQL's built-in FileOpen sandbox—meaning Allow DLL imports stays OFF.

Step-by-Step Installation

  1. Launch the Cortex AI desktop app (npm start or portable release executable).
  2. Open the Settings tab → Install EA to MetaTrader → click Scan & install.
  3. In MetaTrader, right-click Navigator → Expert Advisors → Refresh.
  4. Drag CortexEA onto any chart and check Allow Algo Trading (leave Allow DLL imports unchecked).
  5. Within 1 second, the chart comment displays Cortex AI: connected and the terminal appears in the top selector bar.
ARCHITECTURE

2. System Architecture & Protocol v2.1

All communication between the desktop app and attached MT4/MT5 charts uses newline-delimited JSON (NDJSON) over \\.\pipe\Cortex.AI.v2 defined in app/src/shared/protocol.ts.

DirectionMessage TypeCadence / TriggerPurpose
EA → ApphelloOn attach / reconnectHandshakes protocol 2.0, account login, broker, chart symbol & timeframe.
EA → AppsyncEvery 250msStreams live Bid/Ask, contract specs, balance/equity, open positions, pending orders & rules.
EA → AppbarsEvery 5s / new barStreams up to 120 closed OHLCV bars for the on-device PhD Quant Regime Engine.
App → EAcommandOn user/agent actionDispatches place_order, modify_position, close_position, set_protection, etc.
EA → AppackOn command completionReturns accepted, done (with broker ticket/fill price), or failed.
EXECUTION

3. Order Ticket & Top Execution Bar

Designed for narrow side-by-side placement (`480×820`) next to MetaTrader, the Trade tab places the 2-click SELL / BUY execution buttons at the very top of the viewport, followed immediately by the AI Quant Regime & Alpha Radar.

  • Two-Click Arming: Clicking BUY or SELL arms the button (Confirm BUY / Confirm SELL) for 2.5 seconds; clicking a second time dispatches the order.
  • Fill-Anchored Market Stops: Market orders send slPips and tpPips to the EA so the EA anchors stop-loss and take-profit to the actual broker fill price.
  • Three Sizing Modes: Size by % of Equity, $ Cash Risk, or fixed Lots.
TRADE MANAGEMENT

4. Autonomous EA Protection Rules

Protection rules execute inside the MetaTrader EA on every tick and persist across terminal or desktop restarts in MQL5/Files/CortexEA/rules-<login>-<symbol>.tsv:

  • Break-Even: Moves SL to Entry + Offset pips once floating profit reaches Trigger pips.
  • Trailing Stop: Trails SL behind the highest favorable price excursion by Trail pips.
  • Partial Close (50%): Closes half the position volume once profit reaches Partial Trigger pips and records a partialDone bitmask so it never double-fires.
FUND MANAGER

5. Multi-Terminal Fund Manager (1 → N)

The Fund tab turns Cortex AI into a multi-account execution desk:

  • Pro-Rata Equity %: Risks the same percentage of equity on each selected terminal, automatically converting to each terminal's lot size using its own broker tick value.
  • Equal Cash Risk ($): Risks the exact same dollar amount on each selected terminal.
  • Quant Kelly Optimal: Sizes each terminal using its active chart's Quarter-Kelly regime recommendation.
  • Emergency Flatten All Terminals: Two-click confirmation dispatches close_all across every connected MT4/MT5 terminal simultaneously.
QUANT ENGINE

6. PhD Quant Regime & Portfolio Risk Engine

Implemented in app/src/shared/quant.ts, the engine computes deterministic statistical telemetry from the EA's 120-bar OHLCV stream:

Hurst Exponent (R/S):     H > 0.55 (Trend) | H < 0.45 (Mean-Revert) | ~0.50 (Random Walk)
Yang-Zhang Volatility:    Minimum-variance OHLC estimator (annualized %)
Quarter-Kelly Fraction:   f* = clamp(0.25 * ((p * b - q) / b), 0.25%, 2.00%)
95% 1-Day Parametric VaR: 1.64485 * DailySigma * TotalNotionalExposure
SAFETY

7. Risk Guard & Daily Loss Circuit Breaker

Every order path—UI ticket, Fund Manager, AI Assistant, and MCP/REST Agent—passes through TradingHub and checkRisk() before queuing a command:

  • Max Risk % Per Trade: Blocks any order whose stop-loss risk exceeds your configured percentage.
  • Max Daily Loss %: Tracks your daily equity high-water mark and blocks new entries if daily drawdown reaches your limit.
  • Max Lots & Max Open Positions: Hard caps on position size and concurrent open trades.
DEVELOPERS & AGENTS

8. Local HTTP MCP Server & Ready-Made Harness Prompts

Cortex AI runs a local HTTP Streamable MCP server on http://127.0.0.1:17845/mcp and REST API at http://127.0.0.1:17845/v1. Every connected agent receives 11+ quantitative tools subject to human-in-the-loop approvals and Risk Guard limits.

Quick Harness Connection (No npm Required)

# Claude Code CLI:
claude mcp add --transport http aims-cortex http://127.0.0.1:17845/mcp --header "Authorization: Bearer <YOUR_TOKEN>"

# Cursor IDE / Google Antigravity (mcp.json):
{
  "mcpServers": {
    "aims-cortex": {
      "url": "http://127.0.0.1:17845/mcp",
      "headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
    }
  }
}

# Python Loopback REST API:
curl -H "Authorization: Bearer <YOUR_TOKEN>" http://127.0.0.1:17845/v1/tools/list_terminals

Standard Agent Bootstrap System Prompt

Paste this prompt into your agent harness instructions or .cursorrules to enforce mandatory preview_order planning and hard stop-loss risk guards:

You are an autonomous quantitative execution assistant connected to MetaTrader 4/5 via Cortex AI over MCP.

Immutable operational trading rules:
1. MANDATORY READ-BEFORE-WRITE:
   - Call list_terminals and get_market(sessionId) before taking or proposing any trade.
   - Call get_signals(sessionId) or inspect_chart(sessionId, symbol, timeframe) to verify statistical regime (Hurst exponent, Variance Ratio, Efficiency Ratio, ATR friction). Reject entry if spread exceeds 20% of ATR.

2. MANDATORY PRE-TRADE VALIDATION (PREVIEW FIRST):
   - You MUST call preview_order before place_order. Inspect the returned OrderPlan (lots, cashAtRisk, riskPercent, stopLossPrice) and ensure ok === true with zero Risk Guard violations.

3. HARD RISK CONSTRAINTS:
   - Every order MUST have a non-zero stop loss. Zero-stop trades are prohibited.
   - Risk sizing must respect riskPercent (default 1.0% max) or Quarter-Kelly recommendation.
   - Stop trading immediately if daily drawdown limit is reached.

4. STRUCTURED TRADE EXPLANATION:
   Always state: Terminal & Symbol, Order Intent, Statistical Edge (Hurst / AIMS Box / ATR), and Risk & Sizing before executing.

5. POSITION MANAGEMENT:
   - Call get_positions to monitor open risk.
   - Use manage_position to move stops to break-even or scale out when targets hit.
Cortex AI Co-Pilot
Quant Co-Pilot
¼-Kelly Sizing Armed ⚡