feat: Add Phase 4 advanced metrics and components
- Add advanced metrics dashboard with trade analytics - Add new trading components (EntryTypeAnalysis, MultiDayPositionTracker, NewsEventTracker, etc.) - Add strategy mode selector and trend confirmation - Add risk automation panel and slippage correlation analysis - Add daily trading plan enhancements with modal components - Add custom hooks (useApi, useLocalStorage, useAdvancedTradeMetrics) - Add broker service integration and trading API - Add test setup and vitest configuration - Include parquet data files for live market data - Add comprehensive documentation in docs/ folder
This commit is contained in:
@@ -0,0 +1,361 @@
|
||||
# Phase 3 Quick Reference Card
|
||||
|
||||
## 🎯 Components at a Glance
|
||||
|
||||
### TrendConfirmation.tsx
|
||||
**What it does:** Confirms trend strength before swing entry
|
||||
**Look for:** STRONG or VERY_STRONG (80%+ confidence)
|
||||
**Shows:** EMA alignment, MACD, RSI assessment
|
||||
**When to enter:** VERY_STRONG with all indicators aligned
|
||||
**Best timeframes:** 4h, 1h, 15m (set in props)
|
||||
|
||||
**Props:**
|
||||
```typescript
|
||||
{
|
||||
ema8: number;
|
||||
ema21: number;
|
||||
ema55: number;
|
||||
ema200: number;
|
||||
macdLine: number;
|
||||
macdSignal: number;
|
||||
rsi: number;
|
||||
timeframe?: string;
|
||||
onTrendUpdate?: (trend) => void;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### MultiDayPositionTracker.tsx
|
||||
**What it does:** Tracks multiple swing positions across days
|
||||
**Shows:** Entry date, P&L, profit targets, hold time
|
||||
**Tracks:** Win rate, average hold time, total profit
|
||||
**Displays:** 3-tier profit targets (1/3 each)
|
||||
**Updates:** Metrics dashboard in real-time
|
||||
|
||||
**Props:**
|
||||
```typescript
|
||||
{
|
||||
positions: SwingPosition[];
|
||||
onMetricsUpdate?: (metrics) => void;
|
||||
}
|
||||
```
|
||||
|
||||
**Position Data:**
|
||||
```typescript
|
||||
{
|
||||
id: string;
|
||||
entryDate: string; // ISO date
|
||||
entryPrice: number;
|
||||
quantity: number; // oz
|
||||
direction: 'LONG' | 'SHORT';
|
||||
currentPrice?: number;
|
||||
target1Price?: number; // 1/3 close
|
||||
target1Closed?: boolean;
|
||||
target2Price?: number; // 2/3 close
|
||||
target2Closed?: boolean;
|
||||
target3Price?: number; // Full close
|
||||
target3Closed?: boolean;
|
||||
stopLoss?: number;
|
||||
notes?: string;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### NewsEventTracker.tsx
|
||||
**What it does:** Alerts on news events that affect gold
|
||||
**Shows:** Upcoming events, impact level, time countdown
|
||||
**Categories:** Economic, Earnings, Fed, Geopolitical, Supply
|
||||
**Impacts:** HIGH (avoid), MEDIUM (manage), LOW (trade)
|
||||
**Alerts:** 1 hour, 30 min, 15 min before event
|
||||
|
||||
**Props:**
|
||||
```typescript
|
||||
{
|
||||
events: NewsEvent[];
|
||||
currentTime?: string; // ISO datetime
|
||||
onEventAlert?: (event) => void;
|
||||
showCompleted?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
**Event Data:**
|
||||
```typescript
|
||||
{
|
||||
id: string;
|
||||
title: string;
|
||||
category: 'ECONOMIC' | 'EARNINGS' | 'FED' | 'GEOPOLITICAL' | 'SUPPLY_DEMAND';
|
||||
impact: 'HIGH' | 'MEDIUM' | 'LOW';
|
||||
scheduledTime: string; // ISO datetime
|
||||
status: 'UPCOMING' | 'IN_PROGRESS' | 'COMPLETED';
|
||||
forecast?: number;
|
||||
actual?: number;
|
||||
previous?: number;
|
||||
sentiment?: 'BULLISH' | 'BEARISH' | 'NEUTRAL';
|
||||
description?: string;
|
||||
recommendation?: string;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Trend Confirmation Scoring
|
||||
|
||||
### Perfect Bullish (90+ score):
|
||||
```
|
||||
✅ EMA8 > EMA21 > EMA55 > EMA200 (all stacked)
|
||||
✅ MACD line above signal line
|
||||
✅ RSI between 50-70 (not extreme)
|
||||
→ VERY_STRONG signal, excellent entry
|
||||
```
|
||||
|
||||
### Perfect Bearish (90+ score):
|
||||
```
|
||||
✅ EMA8 < EMA21 < EMA55 < EMA200 (all stacked down)
|
||||
✅ MACD line below signal line
|
||||
✅ RSI between 30-50 (not extreme)
|
||||
→ VERY_STRONG signal, excellent entry
|
||||
```
|
||||
|
||||
### Weak Signal (<50 score):
|
||||
```
|
||||
❌ EMAs misaligned (not stacked)
|
||||
❌ MACD neutral (crossing)
|
||||
❌ RSI extreme (>80 or <20)
|
||||
→ Wait for confirmation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Trading Rules by Strength
|
||||
|
||||
### VERY_STRONG (80-100%)
|
||||
- **Action:** ENTER immediately
|
||||
- **Position size:** Full size
|
||||
- **Risk:** Lower (all aligned)
|
||||
- **Expected hold:** 2-7 days
|
||||
|
||||
### STRONG (65-79%)
|
||||
- **Action:** ENTER with caution
|
||||
- **Position size:** 75% of normal
|
||||
- **Risk:** Moderate
|
||||
- **Expected hold:** 2-5 days
|
||||
|
||||
### MODERATE (50-64%)
|
||||
- **Action:** WAIT for confirmation
|
||||
- **Position size:** 50% of normal
|
||||
- **Risk:** Higher
|
||||
- **Expected hold:** 1-3 days
|
||||
|
||||
### WEAK (<50%)
|
||||
- **Action:** DO NOT ENTER
|
||||
- **Position size:** 0
|
||||
- **Risk:** Very high
|
||||
- **Expected hold:** N/A
|
||||
|
||||
---
|
||||
|
||||
## 📈 Position Tracker Tiers
|
||||
|
||||
### Entry: 5 oz at $2031
|
||||
|
||||
| Tier | Close | Amount | Profit | Target |
|
||||
|------|-------|--------|--------|--------|
|
||||
| T1 | 1/3 | 1.67 oz | +$100 | $2033.00 |
|
||||
| T2 | 1/3 | 1.67 oz | +$200 | $2035.00 |
|
||||
| T3 | 1/3 | 1.67 oz | +$325 | $2037.50 |
|
||||
| **Total** | **Full** | **5 oz** | **+$625** | **All filled** |
|
||||
|
||||
### Real-world example:
|
||||
```
|
||||
Day 1: Price hits $2033 → Close T1 (+$100 profit)
|
||||
Day 2-3: Price pulls to $2034.20 → Still hold T2+T3
|
||||
Day 4: Price hits $2035 → Close T2 (+$70 profit)
|
||||
Day 5+: Price continues → Close T3 at $2037.50 (+$155 profit)
|
||||
|
||||
Result: 5 days, +$325 total, +15.8% return ✅
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗞️ News Event Quick Guide
|
||||
|
||||
### HIGH Impact (Avoid or exit)
|
||||
```
|
||||
❌ Fed Interest Rate Decision
|
||||
❌ Non-Farm Payroll (NFP)
|
||||
❌ Consumer Price Index (CPI)
|
||||
❌ Inflation Reports
|
||||
Action: Close swing or widen stops
|
||||
```
|
||||
|
||||
### MEDIUM Impact (Manageable)
|
||||
```
|
||||
⚠️ Earnings Announcements
|
||||
⚠️ Supply Reports
|
||||
⚠️ Housing Reports
|
||||
Action: Can hold, watch closely
|
||||
```
|
||||
|
||||
### LOW Impact (Trade normally)
|
||||
```
|
||||
✅ Jobless Claims
|
||||
✅ Home Sales
|
||||
✅ Consumer Sentiment
|
||||
Action: Continue trading
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Daily Workflow
|
||||
|
||||
### Morning (5 min)
|
||||
```
|
||||
1. Open Daily Trading Plan
|
||||
2. Select SWING mode
|
||||
3. Check TrendConfirmation
|
||||
└─ If VERY_STRONG → Ready to enter
|
||||
└─ If STRONG → Wait for confirmation
|
||||
└─ If MODERATE or WEAK → Skip today
|
||||
4. Check NewsEventTracker
|
||||
└─ Any HIGH impact today? → Plan around it
|
||||
5. Review existing positions in MultiDayPositionTracker
|
||||
```
|
||||
|
||||
### During Day
|
||||
```
|
||||
1. Monitor entry signals in TrendConfirmation
|
||||
2. Watch P&L in MultiDayPositionTracker
|
||||
3. Check news events countdown
|
||||
4. Close positions at tier targets
|
||||
5. Add notes if needed
|
||||
```
|
||||
|
||||
### End of Day
|
||||
```
|
||||
1. Review closed positions
|
||||
2. Check metrics (win rate, hold time)
|
||||
3. Plan for tomorrow
|
||||
4. Note improvements
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Tips for Success
|
||||
|
||||
### With TrendConfirmation
|
||||
✅ Wait for STRONG signals (avoid WEAK)
|
||||
✅ Check all 3 factors (EMA, MACD, RSI)
|
||||
✅ Higher timeframes = more reliable
|
||||
✅ Overbought/oversold (RSI >70/<30) = reversal risk
|
||||
|
||||
### With MultiDayPositionTracker
|
||||
✅ Close 1/3 at each tier (mechanical)
|
||||
✅ Let final 1/3 run for bigger move
|
||||
✅ Track hold time (2-5 days = ideal)
|
||||
✅ Monitor win rate (target 60%+)
|
||||
|
||||
### With NewsEventTracker
|
||||
✅ Avoid entering before HIGH impact
|
||||
✅ ENTER AFTER event if trend confirmed
|
||||
✅ Set wider stops if holding through news
|
||||
✅ Watch forecast vs actual
|
||||
|
||||
---
|
||||
|
||||
## 🎓 Common Mistakes to Avoid
|
||||
|
||||
### ❌ Entering on WEAK signals
|
||||
- Leads to 40% win rate or worse
|
||||
- Use STRONG+ only
|
||||
|
||||
### ❌ Not using profit tiers
|
||||
- Miss opportunity to lock in wins
|
||||
- Use 3-tier system always
|
||||
|
||||
### ❌ Ignoring news events
|
||||
- Get surprised by big moves
|
||||
- Check calendar daily
|
||||
|
||||
### ❌ Holding too long
|
||||
- Swing = 2-5 days max
|
||||
- Don't let it become a long-term hold
|
||||
|
||||
### ❌ Over-sizing positions
|
||||
- Use consistent sizing
|
||||
- Scale based on confidence
|
||||
|
||||
---
|
||||
|
||||
## 📊 Success Metrics
|
||||
|
||||
### Target Daily
|
||||
- ✅ Win rate: 60%+
|
||||
- ✅ Avg hold: 2-5 days
|
||||
- ✅ Positions active: 2-3
|
||||
|
||||
### Target Weekly
|
||||
- ✅ Closed: 3-5 positions
|
||||
- ✅ Total profit: 3-5% of account
|
||||
- ✅ No HIGH impact surprises
|
||||
|
||||
### Target Monthly
|
||||
- ✅ Win rate: 65%+
|
||||
- ✅ Avg profit/trade: 1.5-2%
|
||||
- ✅ Positions completed: 15+
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### No signals showing
|
||||
- ✅ Check if mode is SWING/HYBRID
|
||||
- ✅ Check trend confirmation (may be WEAK)
|
||||
- ✅ Wait for stronger signal
|
||||
|
||||
### Can't see positions
|
||||
- ✅ Check if swingPositions array has data
|
||||
- ✅ Ensure positions added to tracker
|
||||
- ✅ Refresh page if needed
|
||||
|
||||
### News not updating
|
||||
- ✅ Check if events array populated
|
||||
- ✅ Verify event dates/times
|
||||
- ✅ Check for HIGH impact events
|
||||
|
||||
---
|
||||
|
||||
## 📱 Mobile Notes
|
||||
|
||||
All components are **fully responsive**:
|
||||
- ✅ Trend Confirmation: Works on mobile
|
||||
- ✅ Position Tracker: Collapsible on small screens
|
||||
- ✅ News Events: Touch-friendly on mobile
|
||||
|
||||
Best experience: Desktop or tablet for monitoring
|
||||
|
||||
---
|
||||
|
||||
## ⌨️ Keyboard Shortcuts (Coming Phase 4)
|
||||
|
||||
- `S` → Switch to SWING mode
|
||||
- `T` → Toggle Trend Confirmation
|
||||
- `P` → Show positions
|
||||
- `N` → Show news events
|
||||
- `C` → Close position (with confirmation)
|
||||
|
||||
---
|
||||
|
||||
## 📞 Need Help?
|
||||
|
||||
**Refer to:**
|
||||
1. PHASE3_SWING_TRADING_OPTIMIZATION.md (detailed guide)
|
||||
2. COMPLETE_SYSTEM_INDEX.md (system architecture)
|
||||
3. SESSION_COMPLETION_REPORT.md (implementation details)
|
||||
|
||||
---
|
||||
|
||||
**Phase 3 is live and ready!** 🚀
|
||||
|
||||
Start with one swing position using VERY_STRONG trends and watch your results transform! 📈
|
||||
Reference in New Issue
Block a user