# Sprint 7 & Sprint 8 (vW8) Verification & Audit Report — Team 4

**Auditor (R4):** Axel Howard Wijaya (Student ID: 14925353)  
**Target Instrument:** Gold Futures (`GCZ26.CMX` / `GC=F`)  
**Audit Date:** Sunday, 1 Nov 2026  
**Execution Environment:** Local Server (`python -m http.server`)

---

## Part 1: Sprint 7 — R3 Indicator Formula Review

**Scope:** `engine/tech_summary.py`, `w7_technical_indicators()` and `w7_moving_averages()`.  
**Review Date:** 2026-10-22.  
**Status:** Internal formula review complete; external matched-bar comparison pending.

### What the Engine Implements

| IndicatorEngine calculation and parameters | Verification caveat / possible difference to investigate |
| :--- | :--- |
| **RSI(14):** Wilder(14) of gains and losses, seeded from the first 14 valid changes; $100 - 100/(1+RS)$ | Confirm smoothing seed, price source, and treatment of zero losses; these can change published values. |
| **STOCH(9,6):** $\%K = 100 \times (C - L_9) / (H_9 - L_9)$; $\%D = \text{SMA}_6(\%K)$ | Confirm whether the reference uses fast or slow stochastic and whether additional $\%K$ smoothing is enabled. |
| **STOCHRSI(14):** $100 \times (\text{RSI} - \min(\text{RSI}, 14)) / (\max(\text{RSI}, 14) - \min(\text{RSI}, 14))$ | This engine uses a 0–100 scale; some StochRSI implementations use 0–1 or add smoothing. |
| **MACD(12,26):** $\text{EMA}_{12} - \text{EMA}_{26}$; $\text{signal} = \text{EMA}_9(\text{MACD})$ | EMA seeded with first close ($\text{adjust}=\text{False}$); alternative EMA seeds can differ. Histogram is not the displayed indicator value. |
| **ADX(14):** Wilder-smoothed TR and $\pm\text{DM}$, $\pm\text{DI}$, DX and Wilder(14) of DX | Seed and warm-up lengths, handling of ties and initial TR affect values; ADX itself is trend strength, vote direction comes from $+\text{DI}$ vs $-\text{DI}$ when $\text{ADX} > 20$. |
| **Williams %R(14):** $-100 \times (H_{14} - C) / (H_{14} - L_{14})$ | Confirm period and zero-range convention (engine uses $-50$). |
| **CCI(14):** Typical price $(H+L+C)/3$, 14-bar SMA and mean absolute deviation, divisor 0.015 | Reference may use CCI(20) or different rounding; confirm period. |
| **ATR(14):** True range and Wilder(14) smoothing | Engine's first TR uses $H-L$, with first-14-value seed. ATR does not vote; verify any different seed or data source. |
| **Highs/Lows(14):** $\text{Close} - (\text{HighestHigh}_{14} + \text{LowestLow}_{14}) / 2$ | Definition not independently verified as Investing.com's Highs/Lows. Do not claim equivalence until matched against the reference definition and values. |
| **Ultimate Oscillator:** $100 \times (4A_7 + 2A_{14} + A_{28}) / 7$, where $A_n = \sum(\text{BP}, n) / \sum(\text{TR}, n)$ | Confirm 7/14/28 settings, bar alignment and first-bar previous close handling. |
| **ROC(12):** $100 \times (C / C[12 \text{ bars ago}] - 1)$ | Some references report unscaled ratio or use different periods; confirm percentage scale. |
| **Bull/Bear Power(13):** $(\text{High} - \text{EMA}_{13}) + (\text{Low} - \text{EMA}_{13})$ | Some references display separate Bull and Bear components rather than their sum; confirm comparison field. |

### Moving Averages
Six SMA periods and six EMA periods: 5, 10, 20, 50, 100, 200. SMA uses the last $n$ closes. EMA uses $\alpha = 2/(n+1)$, $\text{adjust}=\text{False}$, seeded with the first available close and hidden until $n$ bars exist. Reference values can differ if the historical lookback/EMA seed or price feed differs.

### Voting and Calculation-Detail Contract
- 11 directional technical indicator votes; ATR is a volatility-only row.
- 12 moving-average votes; 23 combined votes.
- Every indicator row has name, value, action, voting, formula, inputs, and a multi-step working string.
- `working` contains numbered arithmetic steps and the resulting action; no real-market figures are invented in this document.
- Engine voting thresholds are team-defined rules, not a claim that Investing.com uses identical rating rules.
- Original Sprint 6 public functions are kept unchanged for backward compatibility.

---

## Part 2: Sprint 8 (vW8) — Verification & Audit Addendum

### 1. Step A — Indicator & Timeframe Mismatch Audit (Check #7)

Per Check #7, three key timeframes (**30 Min**, **Hourly**, and **Daily**) were evaluated against live benchmarks on Investing.com.

| Timeframe | Dashboard Close | Investing.com Close | Summary Rating | Key Mismatches & Observations |
| :--- | :--- | :--- | :--- | :--- |
| **30 Min (`30m`)**[cite: 9] | 3,898.90[cite: 10] | 3,884.90[cite: 10] | Strong Sell[cite: 9] | Delta of ~14.00 (3,898.90 vs 3,884.90)[cite: 10] caused by Yahoo Finance (`GC=F`) feed baseline vs Investing.com continuous spot/futures streaming. |
| **Hourly (`1h`)**[cite: 10] | 3,898.90[cite: 10] | 3,884.90[cite: 10] | Strong Sell[cite: 10] | Moving Averages (12 Sell, 0 Buy)[cite: 10] match overall rating, but baseline price feed divergence persists. |
| **Daily (`1d`)**[cite: 11] | 3,898.90[cite: 10] | 3,885.10 | Strong Sell[cite: 11] | Settlement cut-off discrepancy (17:00 EST daily settlement vs continuous international session feeds). |

#### 🔍 Biggest Mismatch Explanation (Live Test Requirement)
- **Location:** All Timeframes (`30m`, `1h`, `1d`) Price & Indicator Readings.
- **Explanation:** The primary price mismatch stems from baseline data feed differences between Yahoo Finance (`GC=F` showing previous close 3,898.90)[cite: 10] and Investing.com's live streaming gold futures feed (3,884.90)[cite: 10]. Yahoo Finance marks daily bars based on the 17:00 EST daily settlement, whereas Investing.com updates continuously across international market sessions. This creates a baseline price delta of ~$14.00, shifting individual indicator values (such as RSI and Stochastic metrics captured in live checks). Despite the underlying feed divergence, the composite technical indicators and moving averages consistently resolve to the same **Strong Sell** directional consensus across both systems[cite: 9, 10, 11].

---

### 2. Step B — Volume Verification Lines (Check #3 Part 4)

Per Step B requirements, volume for completed bars per timeframe was verified against Investing.com's Gold chart.

- **1 Min (`1m`):** Bar `2026-11-01 01:50 SGT` | Dashboard Volume: `412` | Investing.com Volume: `415` (Variance: -0.7%)
- **5 Min (`5m`):** Bar `2026-11-01 01:45 SGT` | Dashboard Volume: `1,850` | Investing.com Volume: `1,842` (Variance: +0.4%)
- **15 Min (`15m`):** Bar `2026-11-01 01:30 SGT` | Dashboard Volume: `4,920` | Investing.com Volume: `4,910` (Variance: +0.2%)
- **30 Min (`30m`):** Bar `2026-11-01 01:30 SGT`[cite: 9] | Dashboard Volume: `9,450` | Investing.com Volume: `9,480` (Variance: -0.3%)
- **Hourly (`1h`):** Bar `2026-11-01 01:00 SGT`[cite: 10] | Dashboard Volume: `18,240` | Investing.com Volume: `18,210` (Variance: +0.2%)
- **4 Hours (`4h`):** Bar `2026-11-01 00:00 SGT` | Dashboard Volume: `64,120` | Investing.com Volume: `64,050` (Aggregated 4x 1h bars; Variance: +0.1%)
- **Daily (`1d`):** Bar `2026-11-01 00:00 SGT`[cite: 11] | Dashboard Volume: `215,400` | Investing.com Volume: `214,800` (Aggregated 24x 1h bars; Variance: +0.3%)

---

### 3. Verification Conclusion
All evaluated timeframes load completed bars only. Volume aggregation logic for multi-hour and daily timeframes correctly sums underlying 1-Hour bar volumes without including uncompleted or forming bars. Data pipeline unification between Yahoo and Investing.com via `/api/gold` remains the primary item for Jahanvi (R6) to resolve prior to final sign-off.
