All projects

Apex TA

Quantitative technical analysis and strategy backtesting terminal with institutional position sizing, WASD chart navigation, and MongoDB Atlas persistence

Year
Nov 2026
Field
Quantitative Finance
Built with
Next.js, TypeScript, MongoDB Atlas, Lightweight Charts, Quantitative Finance, Tailwind CSS
Apex TA: Trading terminal

Overview

A quantitative technical analysis, strategy backtesting, and paper execution platform built on Next.js 15, Lightweight Charts, and MongoDB Atlas. It centers on four core institutional market structure pillars — the 200-Day Moving Average (200-DMA), Period High/Low, Volume & Relative Volume (RVOL), and a 10-Strategy Hedge Fund & Prop Desk Backtesting Engine — paired with keyboard-first chart navigation (W/A/S/D) and bar-by-bar historical market replay.

Technical Challenges

Warmup-Aware Indicator Pipeline Without Lookahead Bias

Computing a 200-Day Simple Moving Average on a 1-month (22-bar) or 3-month (65-bar) viewport normally leaves the moving average blank or truncated. The market data engine always fetches and caches a full 5-year (1,260-trading-day) daily OHLCV history, computes all moving averages (200/50/20 SMA, EMA 12/26, Bollinger Bands, RSI-14, MACD, ATR-14, Rolling VWAP, and 20-day Z-Score) across the full 5-year series first, and then slices to the display window so every bar on even a 1-month chart has a warm, accurate 200-DMA.

Multi-Pane Synchronized Charting & Bounded WASD Navigation

The chart workspace synchronizes up to four independent Lightweight Charts canvases — Main Candlestick/Volume + Overlays, Strategy Equity Curve vs. Buy & Hold, RSI(14), and MACD(12, 26, 9). Because sub-panes with shorter indicator series would otherwise drift on logical index alignment, leading bars are padded with WhitespaceData timestamps so every pane shares identical logical indices 0 .. N-1. Capture-phase keyboard controls (W/S to zoom in/out, A/D to pan left/right, 0/R to reset) clamp logical ranges strictly to [0, N-1] with fixLeftEdge and fixRightEdge so the viewport never scrolls into empty space.

Hedge Fund & Prop Trading Strategy Engine

The backtest engine evaluates 10 built-in institutional strategies plus a custom multi-factor rule builder:

  • Statistical Arbitrage Z-Score Mean Reversion: Ornstein-Uhlenbeck inspired rolling N-day price Z-Score model entering on extreme dislocations (Z ≤ -1.75σ) and exiting on equilibrium reversion (Z ≥ +0.25σ).
  • CTA Volatility-Targeted Trend & Chandelier Exit: Scales position size inversely to realized ATR(14) volatility to target a configurable annualized portfolio volatility (e.g., 20% Ann. Vol) and trails an N × ATR(14) Chandelier Stop from the highest high since entry.
  • Prop Desk Rolling VWAP & RVOL Breakout: Triggers on institutional participation when price reclaims the N-day Rolling VWAP on a Relative Volume surge (RVOL ≥ 1.25x) with a strong upper-range close.
  • Multi-Factor Quant Alpha Composite: Combines four customizable alpha sleeve weights (Trend, Momentum, Mean-Reversion, and Order Flow) into a -100 to +100 composite score.

Institutional Position Sizing & Execution Friction

Rather than naive all-in backtesting, trades support Inverse ATR Volatility Targeting, Fixed-Fractional ATR Risk % (sizing shares so an N × ATR stop equals a fixed percentage of equity), and Fixed % of Equity, alongside configurable slippage (bps), commission (bps), dynamic ATR stops/targets, and max-holding-period time stops. It computes annualized Sharpe and Sortino ratios, Profit Factor, Max Drawdown, Expectancy, and Alpha vs. Buy & Hold.

Resilient Market Data & MongoDB Atlas Persistence

Market data resolves through a multi-provider chain (Yahoo Finance v8 → Alpha Vantage → Finnhub → deterministic seeded geometric Brownian motion fallback). Order tickets (Market, Limit, and Stop orders with Stop-Loss/Take-Profit brackets), custom watchlist setup notes/price targets, and strategy backtest snapshots persist to MongoDB Atlas (tickets, portfolios, tickers, and strategy_runs collections) with an automatic local fallback when offline.

System architecture

  • Client
  • Service
  • External / AI
  • Storage
  • Live

The market data router fetches a full 5-year daily OHLCV history (Yahoo Finance v8 with Alpha Vantage, Finnhub, and deterministic GBM fallbacks) so the indicator pipeline can warm up the 200-DMA, ATR(14), Rolling VWAP, and Z-Score before slicing to the active timeframe. Four synchronized Lightweight Charts panes share whitespace-aligned logical indices with bounded WASD keyboard zoom/pan. The strategy engine backtests 10 hedge fund and prop desk models with Volatility-Target and ATR-Risk position sizing, while order tickets, watchlist notes, and backtest runs persist to MongoDB Atlas.

Next project · Interview PrepInterviewPulseA daily-scraped bank of interview questions for 936 companies, quality-scored, de-duplicated and ranked by popularity on MongoDB Atlas