Public
Remixed
Gold Trading Bot with Video Strategy Extractor
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

🥇 XAU/USD Gold Trading Bot

A gold scalping bot and trading dashboard built on Val Town, implementing the Ultimate Hybrid Gold Trading Strategy. It fetches live XAU/USD data from Twelve Data, runs a multi-layer technical analysis engine, generates trade signals with risk-managed levels, and (optionally) delivers alerts via Telegram.

⚠️ For educational and research purposes only. Gold trading carries significant financial risk.

Getting started

  1. Settings tab → paste your Twelve Data API key (free tier: 800 calls/day). It's stored server-side and never returned to the browser.
  2. Dashboard → click Scan Now to run the first analysis and populate the chart.
  3. Telegram tab (optional) → add a bot token + chat ID, then send a test message.
  4. Strategy Intelligence tab → add custom rules that score alongside the built-in engine.
  5. DashboardStart Auto-Scan to enable scheduled scanning (every 15 min on free tier).

Architecture

Rendering mermaid diagram...

The analysis engine (src/lib/analysis.ts)

A pure-TypeScript library combining many methodologies, each contributing a weighted bullish/bearish score:

  • EMA trend (20/50/200) + higher-timeframe (1H) bias
  • Market structure: HH/HL vs LH/LL (trend detection)
  • RSI (14) and MACD (12/26/9) histogram momentum
  • ICT Order Blocks (bullish/bearish) and Fair Value Gaps
  • Liquidity Sweep detection — highest weight (3 points)
  • SMT Divergence (price vs RSI)
  • Candlestick patterns (Hammer, Shooting Star, Engulfing, Pin Bar, Marubozu, Morning/Evening Star, Doji)
  • Dynamic Support & Resistance via swing points
  • Trading session filter (scores reduced 30% in low-liquidity hours)

Direction requires a 2-point lead over the opposite side (avoids weak NEUTRAL signals). Confidence = winning side ÷ total score. Stop-loss = ATR × 1.5 anchored to nearest S/R; take-profits at the configured 1.5R / 2.5R / 4.0R.

File map

PathPurpose
main.tsHono HTTP API + serves the dashboard
cron/autoscan.tsScheduled auto-scan (interval)
src/lib/analysis.tsHybrid analysis engine
src/lib/indicators.tsEMA/RSI/MACD/ATR/swing math
src/lib/patterns.tsCandlestick patterns
src/lib/market.tsTwelve Data fetcher
src/lib/telegram.tsOutbound Telegram notifier
src/lib/pipeline.tsfetch → analyze → persist → notify
src/lib/db.tsSQLite schema + helpers (5 tables)
src/frontend/*React dashboard (Twind styling)

Notes for Val Town

  • Twelve Data API key and Telegram credentials are stored in SQLite (configured via the dashboard) — not env vars — so no setup outside the app is needed.
  • The free tier enforces a 15-minute minimum cron interval. Upgrade for tighter scheduling.
  • This was adapted from a Netlify/Postgres design to Val Town's Deno runtime (HTTP vals, project SQLite, interval cron).