OPEN-SOURCE SCRIPT
AMD Visual State Model [POC]

# AMD Visual State Model - Quick Start Guide
## 🎯 Goal
Get the indicator running on your TradingView chart in under 5 minutes.
---
## ⚡ 5-Minute Setup
### Step 1: Install (2 minutes)
1. Open [TradingView](tradingview.com)
2. Open any chart (recommend ES1! or NQ1! futures, 1-minute timeframe)
3. Click Pine Editor at bottom of screen
4. Click "New" → "Blank indicator script"
5. Delete all default code
6. Copy/paste entire contents of `amd_complete.pine`
7. Click "Save" → Name it: `AMD Visual State Model`
8. Click "Add to Chart"
### Step 2: First Look (1 minute)
You should now see:
- ✅ Blue/orange boxes (session ranges) - if during Asian/London hours
- ✅ Yellow horizontal lines (liquidity levels) - if after 08:00 NY
- ✅ Gray/orange vertical lines (time markers) - at 09:30 and 10:00 NY
**If nothing appears:** Check that it's a trading day and within session hours.
### Step 3: Settings (2 minutes)
Click indicator name → Settings icon (gear) → Inputs tab
**Verify timezone:**
```
Timezone: America/New_York ✓
```
**Recommended starting values (already defaults):**
```
Sweep Distance (ATR): 1.5 ✓
Displacement ATR: 2.0 ✓
FVG Min Size: 0.5 ✓
Entry Timeout: 60 minutes ✓
Max Entries Per Day: 1 ✓
```
**Visual settings:**
- Enable all checkboxes (Show Session Ranges, Show Liquidity Levels, etc.)
- Adjust opacity if chart is too cluttered (default 90 is good)
**Alert settings:**
- Enable all 5 alert types
- You'll set up actual alerts in Step 4
Click "OK"
---
## 🔔 Setting Up Alerts (3 minutes)
### Critical Alert: Entry Allowed
1. Click indicator name on chart
2. Click "⋮" (three dots) → "Add alert on AMD Visual State Model"
3. **Condition:** "Any alert() function call" OR specific "Entry Allowed" message
4. **Alert name:** "AMD Entry Signal - [SYMBOL]"
5. **Options:**
- Trigger: "Once Per Bar Close" ✓
- Expiration: "Open-ended" ✓
6. **Notifications:**
- ✓ Notify on app
- ✓ Show popup
- ✓ Send email (optional)
- ✓ Webhook URL (if using automation - leave blank for now)
7. Click "Create"
### Optional: Set Up All 5 Alerts
Repeat above for each alert type:
1. Manipulation Detected
2. Distribution Confirmed
3. FVG Formed
4. Price in Entry Zone
5. Entry Allowed ⭐ (most critical)
---
## 📊 First Day Usage
### Pre-Market (Before 09:30 NY)
**Action:** None - just ensure indicator is on chart
### Asian Session (18:00-02:00 NY)
**What to expect:**
- Blue box appears showing Asian high/low range
- This happens automatically
**Action:** None required
### London Session (03:00-08:00 NY)
**What to expect:**
- Orange box appears showing London high/low range
- At 08:00, yellow lines appear = liquidity levels
- State advances to ACCUMULATION_READY
**Action:** None required - just observation
### NY Open (09:30 NY)
**What to expect:**
- Gray vertical line appears
- State is still ACCUMULATION_READY
**Action:** Get ready to watch
### Decision Point (10:00 NY) ⭐
**What to expect:**
- Orange vertical line appears
- State advances to MANIPULATION_ARMED
- Now watching for liquidity sweep
**Action:** Active monitoring begins
### 10:00-11:00 (The Trading Window)
**Watch for this sequence:**
#### 1. 🔼/🔽 MANIPULATION LABEL
- Price sweeps liquidity level (high or low)
- Reverses quickly
- Label appears: "🔼 BULLISH SWEEP" or "🔽 BEARISH SWEEP"
- Alert fires: "Manipulation Detected"
**What this means:** Setup is activating. Direction is determined.
#### 2. ⚡ DISPLACEMENT LABEL
- Large candle appears in direction opposite the sweep
- Label: "⚡ DISPLACEMENT"
- State: DISTRIBUTION_ARMED
**What this means:** Institutional involvement confirmed.
#### 3. 📊 STRUCTURE SHIFT LABEL
- Price breaks swing high (bullish) or swing low (bearish)
- Label: "📊 STRUCTURE SHIFT"
- Alert fires: "Distribution Confirmed"
**What this means:** Trend change confirmed. Watch for entry zone.
#### 4. FVG BOX APPEARS
- Green box (bullish) or red box (bearish)
- Shows "gap" in price where imbalance occurred
- Alert fires: "FVG Formed"
**What this means:** Entry zone identified. Wait for price to retrace.
#### 5. 🎯 ENTRY SIGNAL
- Price touches/enters FVG zone
- Big label appears: "🎯 LONG ENTRY" or "🎯 SHORT ENTRY"
- Alert fires: "ENTRY ALLOWED" ⭐
**What this means:** ALL CONDITIONS MET. Execute trade.
---
## 💡 Your First Trade (Paper Trading Recommended)
### When Entry Signal Appears:
**For LONG Entry (Bullish Sweep):**
```
Entry: Current price (in FVG zone)
Stop Loss: Below manipulation low
Take Profit: 1.5-2x risk
```
**For SHORT Entry (Bearish Sweep):**
```
Entry: Current price (in FVG zone)
Stop Loss: Above manipulation high
Take Profit: 1.5-2x risk
```
### Example Trade (Bullish)
```
Manipulation low: 4845.00
Entry price: 4850.00 (in FVG)
Stop loss: 4843.00 (2 points below manip low)
Risk: 7 points
Target: 4860.50 (1.5R) or 4871.00 (3R)
```
**Position sizing:**
- Determine $ risk per trade (e.g., $500)
- Calculate: Contracts = $500 / (7 points × $50/point) = 1.4 → round to 1 contract
---
## 🐛 Troubleshooting First Day Issues
### "I don't see any boxes or lines"
**Check:**
1. Is it a trading day? (Not weekend/holiday)
2. Is it within session hours?
3. Are visual settings enabled? (Click indicator → Settings → Inputs → scroll to Visual Settings)
### "I see session boxes but no liquidity levels"
**Reason:** Liquidity levels only appear after sessions complete (after 08:00 NY)
**Solution:** Wait until London session ends
### "I got manipulation alert but no FVG formed"
**Possible reasons:**
1. Distribution phase incomplete (need displacement + structure shift)
2. No valid FVG detected (gap too small)
3. Settings too strict
**Solution:** Enable debug mode to see what's blocking progression
### "Entry signal never appeared"
**Check debug table:**
- Is FVG detected? ✓
- Is price in FVG? (may have missed it)
- Is entry timeout reached? (>60 minutes past 10am)
**Solutions:**
- Increase entry timeout to 90 minutes
- Watch price more closely when FVG forms
---
## 🎓 Learning Mode (First Week)
### Day 1-2: Observation Only
- Watch indicator state progression
- Note when each label appears
- Don't take trades yet - just learn the flow
### Day 3-5: Paper Trading
- Take trades on paper when entry signal appears
- Track outcomes in spreadsheet
- Refine understanding of risk/reward
### Day 6-10: Small Size Live
- If paper results positive, start with 1 micro contract (MES/MNQ)
- Gradually increase as confidence builds
---
## 📈 Success Metrics (First 30 Days)
Track these metrics:
**Setup Quality:**
- Total days with complete AMD cycle: ___ / 20 trading days
- % of cycles that completed: ___% (target: >50%)
**Entry Quality:**
- Total entry signals: ___
- Signals taken: ___
- Win rate: ___% (target: >55%)
**Execution Quality:**
- Average R-multiple: ___ (target: >1.5R)
- Max adverse excursion: ___ (should be < stop distance)
- Max favorable excursion: ___ (should be > 2R minimum)
---
## 🔧 Settings Adjustment After First Week
### If too many false signals:
```
Sweep ATR: 1.5 → 2.0
Displacement ATR: 2.0 → 2.5
FVG Min Size: 0.5 → 0.7
```
### If missing good setups:
```
Sweep ATR: 1.5 → 1.2
Displacement ATR: 2.0 → 1.7
FVG Min Size: 0.5 → 0.4
Entry Timeout: 60 → 90 minutes
```
### If setups never complete:
```
Structure Confirm: 2 → 1 bar
Swing Length: 5 → 3
FVG Lookback: 10 → 15 bars
```
---
## 📱 Mobile Setup (Optional)
1. Download TradingView app
2. Open saved chart with AMD indicator
3. Alerts will push to phone when conditions met
4. Can monitor progression on mobile
**Limitations:**
- Smaller screen (harder to see details)
- Debug table may be hard to read
- Recommend tablet over phone for active monitoring
---
## ✅ Day 1 Checklist
Before market open tomorrow:
- [ ] Indicator installed on chart
- [ ] Settings verified (timezone, defaults)
- [ ] At least "Entry Allowed" alert set up
- [ ] Alert notifications working (test with random alert)
- [ ] Risk management plan documented
- [ ] Position size calculated
- [ ] Stop loss strategy defined
- [ ] Trading journal ready to log results
---
## 🎯 Key Reminders
1. **One setup per day maximum** (unless max entries increased)
2. **Only trade after 10:00 AM** (decision point)
3. **Wait for entry signal** (don't anticipate)
4. **Stop loss is mandatory** (below/above manipulation level)
5. **If in doubt, sit out** (better to miss setup than lose capital)
---
## 📞 Next Steps
**After first successful setup observed:**
→ Review full documentation (AMD_DOCUMENTATION.md)
**After 10-20 trades:**
→ Analyze results, adjust parameters
**After 60 days with positive results:**
→ Consider strategy version for automation
---
**Good luck with your first AMD setup!**
Remember: The indicator prevents premature entry. Trust the state progression.
## 🎯 Goal
Get the indicator running on your TradingView chart in under 5 minutes.
---
## ⚡ 5-Minute Setup
### Step 1: Install (2 minutes)
1. Open [TradingView](tradingview.com)
2. Open any chart (recommend ES1! or NQ1! futures, 1-minute timeframe)
3. Click Pine Editor at bottom of screen
4. Click "New" → "Blank indicator script"
5. Delete all default code
6. Copy/paste entire contents of `amd_complete.pine`
7. Click "Save" → Name it: `AMD Visual State Model`
8. Click "Add to Chart"
### Step 2: First Look (1 minute)
You should now see:
- ✅ Blue/orange boxes (session ranges) - if during Asian/London hours
- ✅ Yellow horizontal lines (liquidity levels) - if after 08:00 NY
- ✅ Gray/orange vertical lines (time markers) - at 09:30 and 10:00 NY
**If nothing appears:** Check that it's a trading day and within session hours.
### Step 3: Settings (2 minutes)
Click indicator name → Settings icon (gear) → Inputs tab
**Verify timezone:**
```
Timezone: America/New_York ✓
```
**Recommended starting values (already defaults):**
```
Sweep Distance (ATR): 1.5 ✓
Displacement ATR: 2.0 ✓
FVG Min Size: 0.5 ✓
Entry Timeout: 60 minutes ✓
Max Entries Per Day: 1 ✓
```
**Visual settings:**
- Enable all checkboxes (Show Session Ranges, Show Liquidity Levels, etc.)
- Adjust opacity if chart is too cluttered (default 90 is good)
**Alert settings:**
- Enable all 5 alert types
- You'll set up actual alerts in Step 4
Click "OK"
---
## 🔔 Setting Up Alerts (3 minutes)
### Critical Alert: Entry Allowed
1. Click indicator name on chart
2. Click "⋮" (three dots) → "Add alert on AMD Visual State Model"
3. **Condition:** "Any alert() function call" OR specific "Entry Allowed" message
4. **Alert name:** "AMD Entry Signal - [SYMBOL]"
5. **Options:**
- Trigger: "Once Per Bar Close" ✓
- Expiration: "Open-ended" ✓
6. **Notifications:**
- ✓ Notify on app
- ✓ Show popup
- ✓ Send email (optional)
- ✓ Webhook URL (if using automation - leave blank for now)
7. Click "Create"
### Optional: Set Up All 5 Alerts
Repeat above for each alert type:
1. Manipulation Detected
2. Distribution Confirmed
3. FVG Formed
4. Price in Entry Zone
5. Entry Allowed ⭐ (most critical)
---
## 📊 First Day Usage
### Pre-Market (Before 09:30 NY)
**Action:** None - just ensure indicator is on chart
### Asian Session (18:00-02:00 NY)
**What to expect:**
- Blue box appears showing Asian high/low range
- This happens automatically
**Action:** None required
### London Session (03:00-08:00 NY)
**What to expect:**
- Orange box appears showing London high/low range
- At 08:00, yellow lines appear = liquidity levels
- State advances to ACCUMULATION_READY
**Action:** None required - just observation
### NY Open (09:30 NY)
**What to expect:**
- Gray vertical line appears
- State is still ACCUMULATION_READY
**Action:** Get ready to watch
### Decision Point (10:00 NY) ⭐
**What to expect:**
- Orange vertical line appears
- State advances to MANIPULATION_ARMED
- Now watching for liquidity sweep
**Action:** Active monitoring begins
### 10:00-11:00 (The Trading Window)
**Watch for this sequence:**
#### 1. 🔼/🔽 MANIPULATION LABEL
- Price sweeps liquidity level (high or low)
- Reverses quickly
- Label appears: "🔼 BULLISH SWEEP" or "🔽 BEARISH SWEEP"
- Alert fires: "Manipulation Detected"
**What this means:** Setup is activating. Direction is determined.
#### 2. ⚡ DISPLACEMENT LABEL
- Large candle appears in direction opposite the sweep
- Label: "⚡ DISPLACEMENT"
- State: DISTRIBUTION_ARMED
**What this means:** Institutional involvement confirmed.
#### 3. 📊 STRUCTURE SHIFT LABEL
- Price breaks swing high (bullish) or swing low (bearish)
- Label: "📊 STRUCTURE SHIFT"
- Alert fires: "Distribution Confirmed"
**What this means:** Trend change confirmed. Watch for entry zone.
#### 4. FVG BOX APPEARS
- Green box (bullish) or red box (bearish)
- Shows "gap" in price where imbalance occurred
- Alert fires: "FVG Formed"
**What this means:** Entry zone identified. Wait for price to retrace.
#### 5. 🎯 ENTRY SIGNAL
- Price touches/enters FVG zone
- Big label appears: "🎯 LONG ENTRY" or "🎯 SHORT ENTRY"
- Alert fires: "ENTRY ALLOWED" ⭐
**What this means:** ALL CONDITIONS MET. Execute trade.
---
## 💡 Your First Trade (Paper Trading Recommended)
### When Entry Signal Appears:
**For LONG Entry (Bullish Sweep):**
```
Entry: Current price (in FVG zone)
Stop Loss: Below manipulation low
Take Profit: 1.5-2x risk
```
**For SHORT Entry (Bearish Sweep):**
```
Entry: Current price (in FVG zone)
Stop Loss: Above manipulation high
Take Profit: 1.5-2x risk
```
### Example Trade (Bullish)
```
Manipulation low: 4845.00
Entry price: 4850.00 (in FVG)
Stop loss: 4843.00 (2 points below manip low)
Risk: 7 points
Target: 4860.50 (1.5R) or 4871.00 (3R)
```
**Position sizing:**
- Determine $ risk per trade (e.g., $500)
- Calculate: Contracts = $500 / (7 points × $50/point) = 1.4 → round to 1 contract
---
## 🐛 Troubleshooting First Day Issues
### "I don't see any boxes or lines"
**Check:**
1. Is it a trading day? (Not weekend/holiday)
2. Is it within session hours?
3. Are visual settings enabled? (Click indicator → Settings → Inputs → scroll to Visual Settings)
### "I see session boxes but no liquidity levels"
**Reason:** Liquidity levels only appear after sessions complete (after 08:00 NY)
**Solution:** Wait until London session ends
### "I got manipulation alert but no FVG formed"
**Possible reasons:**
1. Distribution phase incomplete (need displacement + structure shift)
2. No valid FVG detected (gap too small)
3. Settings too strict
**Solution:** Enable debug mode to see what's blocking progression
### "Entry signal never appeared"
**Check debug table:**
- Is FVG detected? ✓
- Is price in FVG? (may have missed it)
- Is entry timeout reached? (>60 minutes past 10am)
**Solutions:**
- Increase entry timeout to 90 minutes
- Watch price more closely when FVG forms
---
## 🎓 Learning Mode (First Week)
### Day 1-2: Observation Only
- Watch indicator state progression
- Note when each label appears
- Don't take trades yet - just learn the flow
### Day 3-5: Paper Trading
- Take trades on paper when entry signal appears
- Track outcomes in spreadsheet
- Refine understanding of risk/reward
### Day 6-10: Small Size Live
- If paper results positive, start with 1 micro contract (MES/MNQ)
- Gradually increase as confidence builds
---
## 📈 Success Metrics (First 30 Days)
Track these metrics:
**Setup Quality:**
- Total days with complete AMD cycle: ___ / 20 trading days
- % of cycles that completed: ___% (target: >50%)
**Entry Quality:**
- Total entry signals: ___
- Signals taken: ___
- Win rate: ___% (target: >55%)
**Execution Quality:**
- Average R-multiple: ___ (target: >1.5R)
- Max adverse excursion: ___ (should be < stop distance)
- Max favorable excursion: ___ (should be > 2R minimum)
---
## 🔧 Settings Adjustment After First Week
### If too many false signals:
```
Sweep ATR: 1.5 → 2.0
Displacement ATR: 2.0 → 2.5
FVG Min Size: 0.5 → 0.7
```
### If missing good setups:
```
Sweep ATR: 1.5 → 1.2
Displacement ATR: 2.0 → 1.7
FVG Min Size: 0.5 → 0.4
Entry Timeout: 60 → 90 minutes
```
### If setups never complete:
```
Structure Confirm: 2 → 1 bar
Swing Length: 5 → 3
FVG Lookback: 10 → 15 bars
```
---
## 📱 Mobile Setup (Optional)
1. Download TradingView app
2. Open saved chart with AMD indicator
3. Alerts will push to phone when conditions met
4. Can monitor progression on mobile
**Limitations:**
- Smaller screen (harder to see details)
- Debug table may be hard to read
- Recommend tablet over phone for active monitoring
---
## ✅ Day 1 Checklist
Before market open tomorrow:
- [ ] Indicator installed on chart
- [ ] Settings verified (timezone, defaults)
- [ ] At least "Entry Allowed" alert set up
- [ ] Alert notifications working (test with random alert)
- [ ] Risk management plan documented
- [ ] Position size calculated
- [ ] Stop loss strategy defined
- [ ] Trading journal ready to log results
---
## 🎯 Key Reminders
1. **One setup per day maximum** (unless max entries increased)
2. **Only trade after 10:00 AM** (decision point)
3. **Wait for entry signal** (don't anticipate)
4. **Stop loss is mandatory** (below/above manipulation level)
5. **If in doubt, sit out** (better to miss setup than lose capital)
---
## 📞 Next Steps
**After first successful setup observed:**
→ Review full documentation (AMD_DOCUMENTATION.md)
**After 10-20 trades:**
→ Analyze results, adjust parameters
**After 60 days with positive results:**
→ Consider strategy version for automation
---
**Good luck with your first AMD setup!**
Remember: The indicator prevents premature entry. Trust the state progression.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.