| --- |
| 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. |
|
|