Header image for Nivas

Nivas

Prompt

# AI AutoBot Mobile — Forex/Gold Trading App (Build Prompt) Paste this into your AI coding tool (Claude Code, etc.) to scaffold the app. ## Objective Build a React Native (Expo) mobile app that serves as the mobile client for the AI AutoBot Cloud Platform, targeting Forex majors/crosses and XAUUSD/XAGUSD via MT5. The app surfaces ML-driven confluence scores from the cloud backend and lets the user monitor, approve, and control trade execution from their phone. ## Backend Integration - Connect to AI AutoBot Cloud Platform's FastAPI layer (AWS ECS/EKS) over REST + WebSocket for real-time updates. - Consume TimescaleDB-backed market data and Kafka/Redis event streams surfaced through backend APIs — the mobile app never talks to these directly. - Pull ML confluence scores (XGBoost/LightGBM) per instrument/timeframe, plus the optional LLM explanation-layer text for each signal. - Broker execution via MetaApi.cloud → MT5, same integration pattern already proven in HYPER AI. ## Core Screens 1. **MT5 Account Login** — see MT5 Login Flow below. 2. **Dashboard** — live confluence scores by instrument, session clock, account equity/exposure. 3. **Market Scanner** — see Market Scanner below. 4. **Signal Feed** — incoming ML signals with explanation text, confidence score, instrument, timeframe. 5. **Live Positions** — open trades, P&L, SL/TP, manual close. 6. **Trade Approval Queue** — signals above the execution threshold wait here for manual confirm (see Execution Gating). 7. **Kill Switch** — one-tap halt on all auto-execution and pending orders; visible on every screen. 8. **Strategy Settings** — per-instrument confluence threshold, position sizing, max concurrent trades. 9. **Trade History** — closed trades, realized P&L, win rate, exportable. 10. **Risk Dashboard** — daily/weekly drawdown vs. caps, account health. 11. **Backtest** — see Backtest Interface below. ## MT5 Login Flow - User enters MT5 account number, password, and broker server name; account type toggle for **Demo** / **Live**. - App sends these to the backend, which provisions/connects the account through MetaApi.cloud (same pattern as HYPER AI) — the mobile app never talks to the MT5 terminal directly. - Only the resulting MetaApi session/connection token is stored on-device (Expo SecureStore / Keychain); the raw MT5 password is never persisted client-side, only relayed once over TLS during login. - Support an **investor-password** login mode for read-only monitoring (view positions/equity, no trade rights) as a lower-risk default for a first connection. - Switching the toggle to **Live** requires a fresh MFA challenge, re-entry of live credentials, and passes through the existing demo-qualification gate before auto-execution unlocks — manual login to a live account alone does not enable auto-trading. - Multiple saved accounts (e.g., one demo, one live) with quick-switch, each remembered as a separate MetaApi connection. ## Market Scanner - Backend continuously scans the configured instrument list (forex majors/crosses, XAUUSD/XAGUSD) across configured timeframes, running the same ML confluence engine used in Backtest and Trade Execution — one scoring path, no drift between what the scanner sees, what gets backtested, and what gets traded. - Default actionable band is **70–85% confidence**, adjustable in Strategy Settings. Scores below the band are logged for the Backtest dataset but not surfaced as actionable signals, keeping Signal Feed free of noise; scores above 85% are flagged as higher-conviction in the feed. - A signal landing in the band is pushed to Signal Feed and routed into Trade Execution — auto-executed if it also clears the separate auto-execution threshold from Execution Gating, otherwise it waits in the Trade Approval Queue. - Scanner screen shows per-instrument status: last scan time, current score, and state (below-band/quiet, in-band/actionable, or already sent to execution) — so the scan itself is visible, not just the signals it produces. - Scan frequency is configurable per instrument/timeframe; backend enforces a minimum interval per instrument to stop the same setup from firing duplicate signals. ## Execution Gating (non-negotiable defaults) - Demo account only until a defined qualification period is met (e.g., minimum N trades or M weeks with drawdown under cap) — mirror the auto-qualification + manual-approval promotion flow already specced for the CRT_SMC platform. - MFA required to switch any account from demo to live. - Auto-execution fires only above a configurable confluence threshold; everything else lands in the Approval Queue for manual confirm. - Kill switch instantly cancels pending orders and blocks new auto-execution — no override. - Hard daily/weekly drawdown caps enforced backend-side, mirrored in the UI. ## Trade Execution - Any signal that clears the confluence threshold (auto) or gets a manual confirm (from the Approval Queue) is submitted to MetaApi.cloud's trade API against the connected MT5 account — the mobile app never talks to the MT5 terminal directly. - Default order type is market execution; support pending (limit/stop) orders when the signal specifies an entry price rather than immediate execution. - SL/TP levels come from the confluence engine's output and are attached at order submission, not added after the fact. - Position size is computed from Strategy Settings' risk-per-trade % against current account equity, capped by max concurrent trades and the daily/weekly drawdown limits already in place. - Configurable slippage/requote tolerance — if the fill price would exceed it, the order is cancelled rather than filled at a worse price. - Fill confirmation or rejection comes back from MetaApi and updates Live Positions immediately; a rejection returns the signal to the Approval Queue with the error reason instead of silently retrying. - Every placed order logs the triggering confluence score and explanation text to Trade History, so execution quality is auditable against the signal that caused it. - Kill switch cancels any in-flight order requests immediately, in addition to blocking new ones from firing. ## Backtest Interface - User picks instrument(s), date range, confluence threshold, and position-sizing/risk settings; the backend runs the same confluence engine used live against historical bars stored in TimescaleDB — no code path difference between backtest and live scoring logic. - Results screen: equity curve, win rate, max drawdown, average R-multiple, trade count, and a full trade log (entry/exit, SL/TP, confluence score at signal time). - Support side-by-side runs so different threshold or risk settings can be compared before picking one to carry into demo trading. - Backtest runs are stored separately from live/demo executed trades in Trade History (tagged as simulated), never mixed into real performance stats. - Tie into the demo-qualification gate: require a backtest report covering a minimum historical window before a demo account is even eligible to start the live-qualification clock — this is where you actually get to see how the confluence threshold would have performed before risking anything, demo or live. ## Tech Stack - Frontend: React Native + Expo, TypeScript, matching HYPER AI's dark navy / electric blue brand system. - State/data: React Query (or equivalent) for polling + WebSocket subscription. - Charting: reuse or adapt HYPER AI's Chart View component. - Auth: same MFA/session pattern as HYPER AI. ## Deliverable A working Expo app scaffold with the 8 screens above, wired to mocked API responses matching the AI AutoBot Cloud Platform's documented endpoints, ready to swap in live backend URLs once the cloud backend is deployed. --- **Note on going live:** since this model hasn't been battle-tested by you personally yet, treat the demo-to-live gate above as mandatory, not optional. Back-test and paper-trade the confluence threshold across a few months of varied conditions before funding a live account — spread and slippage on a real feed will likely mean the threshold needs retuning.

No responses available for this prompt yet