An AI-Powered K-Line Chart Analyzer — Upload a Screenshot, Get Structured Technical Analysis

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5168

    #1

    An AI-Powered K-Line Chart Analyzer — Upload a Screenshot, Get Structured Technical Analysis

    The Problem

    Every trader has been here: you're staring at a candlestick chart, trying to figure out if that's a Head and Shoulders forming or just noise. You flip between three indicator panels, check RSI, squint at the MACD histogram, and still aren't sure.


    I wanted a tool where I could just screenshot a chart and get a structured breakdown — patterns detected, trend direction, confidence scores, and what to watch next. No manual drawing, no subjective interpretation.


    So I built KlineVision.


    What It Does

    Upload any K-line (candlestick) chart screenshot — A-shares, US stocks, crypto, anything — and KlineVision returns:
    • Classic Pattern Detection — Head & Shoulders, Bullish Engulfing, Morning Star, Flags, Triangles, and 70+ more patterns with confidence scores
    • Chan Theory Analysis (缠论) — Bi (笔), Duan (线段), Zhongshu (中枢), and Beichi (背驰) structure detection. If you trade Chinese markets, you know how powerful this is
    • Trend Judgment — Bullish / Bearish / Sideways with strength and confidence
    • Trading Signals — Contextual buy/sell/watch signals with risk notes
    • Bilingual Output — Full analysis in both English and Chinese


    The analysis is powered by Google Gemini's vision model with a carefully crafted prompt that enforces structured JSON output.


    The Tech Stack





    Next.js 16 (App Router, TypeScript)
    ├── EODHD + Tushare (market data)
    ├── Supabase (auth + PostgreSQL)
    ├── Stripe (subscriptions)
    ├── SVG K-line renderer (server-side, zero deps)
    └── 11-locale i18n (en/zh/ja/ko/es/fr/de/pt/ru/ar/hi)







    A few things I'm proud of:


    Pure SVG K-Line Renderer

    Server-rendered candlestick charts that crawlers can see (no Canvas/WebGL). I wrote a pure TypeScript SVG string generator — zero native dependencies, works in Vercel Serverless. It draws candlesticks, MA lines, volume bars, pattern highlights, and annotations, all as SVG XML strings.


    Each page has real data — historical win rates, T+5/10/20 return statistics, recent detection cases — not LLM-generated fluff. The pattern detection runs a rule-based engine on actual OHLCV data from EODHD and Tushare.


    11-Language Support

    Every page renders in 11 languages with proper hreflang tags. Entity content (pattern names, descriptions, FAQs) is stored as L10n objects:






    name:
    en: "Bullish Engulfing"
    zh: "看涨吞没"
    ja: "強気の包み足"
    ko: "상승 장악형"
    # ...







    Translation is done via Gemini batch API (~$0.15 for all entities × 9 languages).


    The prompt is the secret sauce — it forces Gemini to output a strict JSON schema with confidence scores, bilingual explanations, and explicit "what I can't determine from this image" sections. No hallucinated price targets.


    Pattern Detection Pipeline

    Beyond the screenshot analysis, there's a daily data pipeline:

    1. Fetch — Pull OHLCV data from EODHD (US/A-shares) and Tushare (HK)
    2. Detect — Rule-based engine scans for 10 candlestick patterns (Hammer, Engulfing, Doji, Morning/Evening Star, etc.)
    3. Backfill — Calculate T+5/10/20 returns for historical detections
    4. Compute — MACD, RSI, Bollinger Bands snapshots for each stock
    5. Aggregate — Win rate statistics at global/market/symbol level


    Try It



    The core analysis feature is free. I'd love feedback from anyone who trades or is interested in technical analysis.


    What's Next

    • More chart patterns in the rule engine (currently 10, targeting 30+)
    • Multi-timeframe confirmation (daily + 4h + 1h)
    • Real-time pattern alerts via Telegram
    • Hong Kong market expansion (Tushare rate limits are... fun)




    More...
Working...