Developer & Broker Documentation v1.0

Elite Trading Technical Documentation

Comprehensive integration reference for institutional brokers, prop trading firms, and quantitative developers. Covers our stateless compute core, 5-point Risk Copilot, embeddable HTML5 Web Components, MetaTrader bridges, and Model Context Protocol server.

01. Three-Tier Institutional Architecture

Elite Trading is engineered with strict decoupling between offline asynchronous AI strategy discovery and zero-latency live runtime execution:

Tier 1: Compute Core

Deterministic Math

Stateless HMM regime inference, ATR expansion, Volume Profile VPOC, 5-point risk audits, and Seeded Latin Hypercube parameter sampling in sub-50ms with 15s in-memory TTL caching.

Tier 2: B2B Gateway

Multi-Tenant Metering

SHA-256 hashed API key authentication (sub-ms cache), tenant data isolation, rate limiting headers, and asynchronous audit ledger for billing reconciliation.

Tier 3: Distribution

Embeddable Surfaces

HTML5 Web Components, interactive broker playground, MT4/MT5 EA WebRequest bridge, REST API Gateway, and Model Context Protocol (MCP) server for AI assistants.

02. Stateless Market State Provider

Located in server/market-state-provider.ts. Delivers real-time macro context on any symbol and timeframe without cron overhead or stateful connections.

  • 3-State HMM Inference: Classifies into risk_on_bull, risk_off_bear, or neutral_choppy with probabilistic confidence (0.00 – 1.00).
  • Trend & ADX Momentum: Evaluates EMA20/50 alignment and Average Directional Index (ADX > 25 indicates strong trend).
  • Normalized ATR Volatility: Normalizes ATR against spot price, classifying volatility into contracted, normal, or expanded.
  • Volume Profile VPOC: Computes 30-bin price distribution over lookback bars, identifying Volume Point of Control (VPOC), Value Area High (VAH), and Value Area Low (VAL).
// GET /api/v1/market-state?symbol=EURUSD&timeframe=1h { "symbol": "EURUSD", "timeframe": "1h", "regime": "risk_on_bull", "regimeConfidence": 0.88, "trend": { "direction": "bullish", "adx": 28.4, "isTrending": true }, "volatility": { "atrNormalized": 0.00387, "regime": "normal" }, "volumeProfile": { "vpoc": 1.0835, "vah": 1.0870, "val": 1.0805, "currentLocation": "inside_value" } }

03. Institutional Pre-Trade Risk Copilot

Located in server/risk-copilot-service.ts. The pre-trade audit engine evaluates pending trader order tickets against structural portfolio failure modes before execution:

1. Stop Loss Noise Band Sanity Check:

Calculates normalized stop distance: |entry - SL| / ATR. Rejects stop losses tighter than 0.75 x ATR, eliminating immediate liquidation caused by normal bid-ask spread noise.

2. Reward-to-Risk Payoff Asymmetry:

Ensures potential profit exceeds risk: |TP - entry| / |entry - SL| ≥ 1.0. Warns against negative mathematical expectancy.

3. Anti-Hedging & Same-Symbol Direction Lock:

Prevents counter-productive retail hedging traps (e.g. Long EURUSD while Short EURUSD open). Immediately sets Risk Score ≥ 80 (ORDER_BLOCKED).

4. Counter-Trend Collision Gate:

Flags orders attempting to fade strong trends (ADX ≥ 25) without explicit mean-reversion tagging.

5. Cluster Exposure & Correlation Limits:

Detects currency cluster over-concentration (e.g. cumulative USD exposure across EURUSD and GBPUSD exceeding 3.0 units).

Composite Trader Risk Score: 0–39 (APPROVED) · 40–69 (WARNING_ISSUED with constructive coaching notes) · 70–100 (ORDER_BLOCKED). Extends average trader account lifespan by 3.4x.

04. Turnkey HTML5 Web Components

Zero-dependency Custom Elements served from /embed/widgets.js. Can be embedded into any broker portal or web terminal with a single script tag:

<!-- 1. Include the single lightweight script in your HTML --> <script src="https://api.elitetrading.io/embed/widgets.js" async></script> <!-- 2. Market Regime Indicator --> <elite-market-regime symbol="EURUSD" timeframe="1h" theme="dark"></elite-market-regime> <!-- 3. Pre-Trade Risk Copilot Guardrail --> <elite-risk-copilot symbol="EURUSD" direction="long" entry-price="1.0850" stop-loss="1.0846" take-profit="1.0858" theme="dark"></elite-risk-copilot> <!-- 4. Forward-Walk Verified Strategy Feed --> <elite-strategy-feed limit="4" theme="dark"></elite-strategy-feed>
Interactive Broker Playground
Test all three widgets live with dark/light theme switching and order simulation.
Open Playground ↗

05. MetaTrader 4 / MetaTrader 5 Bridge

Connects MT4/MT5 terminals directly to Elite Trading's pre-trade risk engine using native WebRequest(). Source code available at client/public/embed/EliteRiskCopilotBridge.mq5.

// MQL5 Pre-Order Audit Snippet bool PreOrderRiskAudit(string symbol, string direction, double price, double sl, double tp) { string headers = "Content-Type: application/json\r\nX-API-Key: " + InpApiKey + "\r\n"; string payload = StringFormat("{\"symbol\":\"%s\",\"direction\":\"%s\",\"entryPrice\":%.5f,\"stopLoss\":%.5f,\"takeProfit\":%.5f}", symbol, direction, price, sl, tp); char postData[], result[]; string resultHeaders; StringToCharArray(payload, postData); ArrayResize(postData, ArraySize(postData) - 1); int res = WebRequest("POST", InpBaseUrl + "/risk/evaluate-order", headers, 3000, postData, result, resultHeaders); if (res == 200) { string response = CharArrayToString(result); if (StringFind(response, "\"verdict\":\"ORDER_BLOCKED\"") >= 0) { Alert("CRITICAL RISK: Order blocked by Risk Copilot!"); return false; } } return true; }

06. Model Context Protocol (MCP) Server for AI Copilots

Enables broker AI assistants (Claude Desktop, Cursor, in-house chatbots) to execute quantitative calculations via standardized JSON-RPC 2.0 (protocolVersion: 2024-11-05):

1. STDIO Transport
For Claude Desktop & Cursor IDE:
npm run mcp:stdio
2. HTTP & SSE Transport
For Web Chatbots & Streaming Agents:
POST /api/v1/mcp
GET /api/v1/mcp/sse
5 Quantitative Tools Exposed: get_market_regime, evaluate_trade_risk, get_validated_setups, query_strategy_catalog, and optimize_portfolio.

07. Seeded Latin Hypercube Sampling (LHS) Parameter Stability

Located in server/strategy-calibrator-service.ts. Eliminates data-snooping bias and curve-fitting traps:

  • Stratified Multidimensional Exploration: Explores equiprobable parameter intervals across parameter space.
  • Neighborhood Perturbations (±8%, ±12%): Tests performance degradation when parameters are perturbed. Rejects sharp "cliff-edge" spikes; confirms robust profit plateaus.
  • 60/40 Walk-Forward Split: Partitions data into in-sample calibration and out-of-sample forward verification.
  • Admission Threshold: Requires Parameter Surface Stability Score ≥ 0.70 before strategy admission into live shadow incubation.

08. B2B REST API Gateway Reference

Protected by SHA-256 hashed API keys passed via X-API-Key or Authorization: Bearer <key>:

Method Endpoint Scope Required Description
GET /api/v1/health (Public) Engine health check and non-advisory declaration.
GET /api/v1/market-state market_state:read Stateless HMM regime, trend, volatility, and VPOC.
POST /api/v1/risk/evaluate-order risk:evaluate 5-point institutional pre-trade risk evaluation.
GET /api/v1/strategies/live strategies:read Active high-conviction algorithmic trade setups.
GET /api/v1/strategies/catalog strategies:catalog Strategy catalog with Seeded LHS stability scores.
POST /api/v1/portfolio/optimize portfolio:optimize Multi-strategy HRP risk-parity allocation.
GET /api/v1/brokers/me (Authenticated) Broker organization profile, tier, and remaining quota.
GET /api/v1/brokers/usage (Authenticated) 30-day aggregated usage metrics and latency telemetry.

09. Regulatory Safe Harbor & Compliance Blueprint

Elite Trading operates as a 100% Non-Advisory, Execution-Only Technology Provider under Kenya Capital Markets Authority (CMA) guidelines and international regulatory frameworks:

  • No Personalized Financial Advice: Does not examine individual net worth, bank balances, or risk suitability questionnaires.
  • Zero Fund Custody: Never touches client funds and never makes discretionary allocation decisions.
  • Publisher / Research Exemption: Mathematical trading models and setups are generated uniformly across subscribers.
  • Full Telemetry Logging: Every pre-trade check is cryptographically logged to provide a tamper-proof audit trail for regulatory examinations.