OPEN-SOURCE SCRIPT
Telah dikemas kini

Daily Levels & MAs on intraday timeframe

1 030
Daily Levels & MAs - Professional Key Level Tracker

📊 OVERVIEW
A comprehensive indicator that displays critical daily moving averages and key price levels all in one clean view. Perfect for traders who need to see support/resistance zones and trend indicators without cluttering their charts.

🎯 WHAT IT SHOWS
Seven essential reference levels:
- 50 SMA (Daily Simple Moving Average) - Yellow
- 21 EMA (Daily Exponential Moving Average) - Red
- 9 EMA (Daily Exponential Moving Average) - White
- Prior Day High (PDH) - Green
- Prior Day Low (PDL) - Purple/Magenta
- Premarket High (PM High) - Purple
- Premarket Low (PM Low) - Orange

✨ KEY FEATURES
✓ All lines extend to the right with clear price labels
✓ Daily moving averages calculated from daily timeframe data
✓ Prior Day High/Low tracks ONLY regular trading hours (9:30 AM - 4:00 PM)
✓ Premarket levels capture 4:00 AM - 9:30 AM price action
✓ Dotted line style keeps chart clean and readable
✓ Semi-transparent labels don't obstruct price action
✓ Works on ALL intraday timeframes
✓ Auto-updates throughout the day

🔧 TECHNICAL SPECIFICATIONS
- Lines start from beginning of current trading session
- Labels positioned 10 bars to the right of current price
- Max lines: 500 (efficient performance)
- No repainting - uses confirmed historical data
- Premarket lines remain visible during regular hours

📈 IDEAL FOR
- Day traders tracking intraday support/resistance
- Swing traders monitoring key daily trend levels
- Gap traders who need premarket reference points
- Breakout traders watching PDH/PDL violations
- Trend followers using EMA crossovers

💡 HOW TO USE
**Moving Averages:**
- 50 SMA: Long-term trend direction
- 21 EMA: Medium-term momentum
- 9 EMA: Short-term trend and quick reversals

**Price Levels:**
- PDH/PDL: Yesterday's trading range boundaries
- PM High/Low: Today's premarket extremes
- Watch for breaks above/below these levels for potential momentum

🎨 COLOR CODING
- Yellow: 50 SMA (major trend)
- Red: 21 EMA (medium trend)
- White: 9 EMA (fast trend)
- Green: Prior Day High
- Purple/Magenta: Prior Day Low
- Purple: Premarket High
- Orange: Premarket Low

⚙️ SMART FEATURES
- Prior Day calculations exclude premarket/afterhours noise
- Premarket levels reset daily at 4:00 AM
- All levels visible simultaneously without overlap confusion
- Labels show exact price values for precision entries/exits
- Lines automatically adjust length as trading day progresses

📊 TRADING STRATEGIES
**Breakout Trading:**
- Long above PDH with volume confirmation
- Short below PDL with momentum

**Mean Reversion:**
- Fade extremes back to moving averages
- Look for price rejections at PM High/Low

**Trend Following:**
- Buy pullbacks to 9 EMA in uptrends (price above 21/50)
- Sell rallies to 9 EMA in downtrends (price below 21/50)

**Gap Trading:**
- Compare open to PDH/PDL
- Use PM levels to gauge early sentiment

🔒 NO CONFIGURATION NEEDED
Simply add to your chart and start trading! The indicator automatically:
1. Calculates daily moving averages from higher timeframe
2. Tracks prior day regular hours high/low
3. Monitors current premarket session extremes
4. Displays everything with clear labels and prices

Perfect for professional traders who want institutional-grade levels without the complexity!
Nota Keluaran
The core focus of this version is data integrity—ensuring that "Yesterday's Close" and "Premarket Levels" are accurate regardless of chart session settings or data lags.

Key Enhancements & Changes
1. Fixed "Prior Day Close" (PDC) Logic
The Problem: Standard request.security often lags during pre-market hours, showing the close from two days ago instead of yesterday.

The Fix: This version captures the exact 4:00 PM EST close manually from the intraday bars. It "locks" the price as soon as the regular session ends, ensuring your PDC line is 100% accurate the moment the pre-market opens.

Visual Priority: The PDC line is now thicker (width 3) and solid to distinguish it from moving averages. It also features dynamic coloring (Green if current price is above PDC, Red if below).

2. Expanded Moving Average Suite
New Additions: Added the 200 SMA, 5 EMA, and lookahead optimization.

The Full Set: Now includes 200 SMA, 50 SMA, 21 EMA, 9 EMA, and 5 EMA.

Accuracy: Improved request.security calls with lookahead_on to ensure daily averages are perfectly synced with intraday price action.

3. Time-Based Level Tracking
Premarket (PMH/PML): Rewritten to track the "0400-0930" window specifically.

Regular Session (PDH/PDL): Rewritten to isolate the "0930-1600" window. This prevents pre-market spikes from "bleeding" into your Prior Day High/Low levels.

4. Cleaner Chart Geometry
Time-Based Offsets: Switched from bar_index to time coordinates for drawing lines. This prevents lines from looking "broken" or skewed when switching between timeframes (e.g., 1m to 15m).

Automatic Cleanup: Enhanced barstate.islast logic to ensure zero chart clutter and instant label updates on every tick.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.