File size: 2,278 Bytes
bae2bee 1e53124 bae2bee 0eefe1a bae2bee 1e53124 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ---
title: XAUUSD Signal Dashboard
emoji: 🪙
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
---
# XAUUSD Signal Dashboard (Educational)
Signal-only viewer for XAUUSD using a pre-trained PPO reinforcement-learning model
([JonusNattapong/Reinforcement-Learning-for-Gold-Trading-Model](https://huggingface.co/JonusNattapong/Reinforcement-Learning-for-Gold-Trading-Model)).
**This app does not place any trades.** It shows what the model would recommend
(BUY / SELL / HOLD) with SL/TP levels, for you to review and execute manually
on your own MT5 demo account.
## Important: timeframe
The underlying model was trained **only on 15-minute XAUUSD bars**. This app
fetches native 15-minute data from TwelveData to match that exactly — do not
change `INTERVAL` in `app.py` to another timeframe, or predictions become
statistically meaningless (the model has never seen that data distribution).
## Setup
1. Create a new Space on Hugging Face → SDK: **Gradio**.
2. Upload `app.py`, `requirements.txt`, and this `README.md`.
3. Go to **Settings → Variables and secrets** and add a secret:
- `TWELVEDATA_API_KEY` = your TwelveData API key
4. The Space will build automatically. First load may take ~30s while the
PPO model and normalization stats download from the Hub (cached after that).
## How it works
1. Fetch the latest ~200 bars of XAU/USD at 15min interval from TwelveData.
2. Compute the exact 9 features the model was trained on (log return, ATR,
RSI, EMA diff, rolling volatility, time-of-day sin/cos).
3. Build the 13-dim observation (9 features + a flat/no-position state —
this app always asks "starting flat right now, what would the model do?").
4. Normalize using the published `vecnormalize.pkl` stats and run the PPO
policy to get an action + confidence.
5. Convert the model's ATR feature back into price terms to draw SL (1R) and
TP1/TP2/TP3 (1.5R / 3R / 5.3R) levels on the chart.
## Disclaimer
Educational analysis only — not financial advice. The referenced model's
published backtest metrics (Sharpe 7.56, 69% win rate) are self-reported by
the original author and unusually high; treat them with skepticism and only
use this on a demo account. Trading involves risk of loss.
|