Public
Gold protection bot: SL reversal + live trading chat
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.
A gold trading protection bot built on Val Town that detects early stop loss reversals, provides a live trading demo chat, and minimizes losses through deep multi-layer analysis.
⚠️ For educational and research purposes only. Gold trading carries significant financial risk.
- Stop Loss Reversal Detection — Monitors 7 reversal signal types: SL approach, RSI/MACD divergence, market structure breaks, liquidity sweeps, candlestick reversal patterns, momentum shifts, and EMA trend flips
- Live Trading Chat — Interactive chat assistant that analyzes live market data and gives contextual trade recommendations (auto or manual mode)
- Paper Trading Demo — Open/close simulated trades with live P&L tracking, win/loss stats, and automatic SL/TP monitoring
- Source Bot Integration — Pulls recent signals from the Weru Gold Bot to use as context for protection analysis
- Telegram Alerts — Protection warnings, trade signals, and auto-trade notifications sent to your phone
- Auto-Trade Mode — Automatically opens trades on strong signals and closes them when protection level hits DANGER/CRITICAL
- Settings → paste your Twelve Data API key (free tier: 800 calls/day)
- Dashboard → click "Run Protection Check" to start analysis
- Live Chat → type "scan", "price", "buy", or "risk" for instant analysis
- Demo Trade → open paper trades with SL/TP and track P&L
- Telegram (optional) → add bot token + chat ID for push alerts
- Dashboard → "Start Auto-Check" for 24/7 monitoring (every 15 min)
| Level | Score | Action |
|---|---|---|
| ✅ SAFE | 0-24 | Hold position |
| ⚠️ CAUTION | 25-59 | Tighten stop loss |
| 🛑 DANGER | 60-84 | Close position now |
| 🚨 CRITICAL | 85-100 | Consider reversing |
fetch → /api/protect → pipeline → protection engine → persist → notify
↓
analysis engine (hybrid)
↓
auto-trade (if enabled)
| Path | Purpose |
|---|---|
main.ts | Hono HTTP API + serves dashboard |
cron/autocheck.ts | Scheduled auto-protection check (every 15 min) |
src/lib/protection.ts | Stop loss reversal detection engine |
src/lib/chat.ts | AI-style trading chat assistant |
src/lib/pipeline.ts | Fetch → protect → persist → notify → auto-trade |
src/lib/analysis.ts | Hybrid analysis engine (from Weru bot) |
src/lib/indicators.ts | EMA/RSI/MACD/ATR/swing math |
src/lib/patterns.ts | Candlestick pattern detection |
src/lib/market.ts | Twelve Data fetcher |
src/lib/telegram.ts | Telegram notifier |
src/lib/db.ts | SQLite schema + helpers (6 tables) |
src/frontend/* | React dashboard (6 tabs) |
- Reuses the Weru Gold Bot's analysis engine for signal generation
- Source bot URL defaults to the Weru bot endpoint (configurable in Settings)
- Free Val Town tier enforces 15-minute minimum cron interval