OPEN-SOURCE SCRIPT
已更新 Advanced Moving Average Channel

Advanced Moving Average Channel (MAC) is a comprehensive technical analysis tool that combines multiple moving average types with volume analysis to provide a complete market perspective.
Key Features:
1. Dynamic Channel Formation
- Configurable moving average types (SMA, EMA, WMA, VWMA, HMA, TEMA)
- Separate upper and lower band calculations
- Customizable band offsets for precise channel adjustment
2. Volume Analysis Integration
- Multi-timeframe volume analysis (1H, 24H, 7D)
- Relative volume comparison against historical averages
- Volume trend detection with visual indicators
- Price-level volume distribution profile
3. Market Context Indicators
- RSI integration for overbought/oversold conditions
- Channel position percentage
- Volume-weighted price levels
- Breakout detection with visual signals
Usage Guidelines:
1. Channel Interpretation
- Price within channel: Normal market conditions
- Price above upper band: Potential overbought condition
- Price below lower band: Potential oversold condition
- Channel width: Indicates market volatility
2. Volume Analysis
- High relative volume (>150%): Strong market interest
- Low relative volume (<50%): Weak market interest
- Volume trend arrows: Indicate increasing/decreasing market participation
- Volume profile: Shows price levels with highest trading activity
3. Trading Signals
- Breakout arrows: Potential trend continuation
- RSI extremes: Confirmation of overbought/oversold conditions
- Volume confirmation: Validates price movements
Customization:
- Adjust MA length for different market conditions
- Modify band offsets for tighter/looser channels
- Fine-tune volume analysis parameters
- Customize visual appearance
This indicator is designed for traders who want to combine price action, volume analysis, and market structure in a single, comprehensive tool.
Key Features:
1. Dynamic Channel Formation
- Configurable moving average types (SMA, EMA, WMA, VWMA, HMA, TEMA)
- Separate upper and lower band calculations
- Customizable band offsets for precise channel adjustment
2. Volume Analysis Integration
- Multi-timeframe volume analysis (1H, 24H, 7D)
- Relative volume comparison against historical averages
- Volume trend detection with visual indicators
- Price-level volume distribution profile
3. Market Context Indicators
- RSI integration for overbought/oversold conditions
- Channel position percentage
- Volume-weighted price levels
- Breakout detection with visual signals
Usage Guidelines:
1. Channel Interpretation
- Price within channel: Normal market conditions
- Price above upper band: Potential overbought condition
- Price below lower band: Potential oversold condition
- Channel width: Indicates market volatility
2. Volume Analysis
- High relative volume (>150%): Strong market interest
- Low relative volume (<50%): Weak market interest
- Volume trend arrows: Indicate increasing/decreasing market participation
- Volume profile: Shows price levels with highest trading activity
3. Trading Signals
- Breakout arrows: Potential trend continuation
- RSI extremes: Confirmation of overbought/oversold conditions
- Volume confirmation: Validates price movements
Customization:
- Adjust MA length for different market conditions
- Modify band offsets for tighter/looser channels
- Fine-tune volume analysis parameters
- Customize visual appearance
This indicator is designed for traders who want to combine price action, volume analysis, and market structure in a single, comprehensive tool.
版本注释
# 📊 MAC Pro v2.0 - Release Notes**Release Date:** October 2025 | **Pine Script v6**
---
## 🎯 What's New
### 📈 Multi-Timeframe Volume Analysis
- **1H, 24H & 7D Volume**: Real-time volume tracking with trend arrows (↑↓→)
- **Relative Volume**: Percentage vs MA with color coding (Green >120%, Red <80%)
- **Smart Alerts**: Notifications for volume spikes >100%
### 📊 Volume Profile + POC
- **10-Level Price Distribution**: ASCII histogram (█▓▒░) showing volume by price
- **Point of Control (POC)**: Yellow line marking highest volume price level
- **Configurable Lookback**: Analyze up to 10,000 bars
### 💹 Advanced Volume Indicators
- **OBV (On Balance Volume)**: Accumulation/Distribution signals
- **Volume Momentum**: Percentage change from average (-50% to +100%)
- **A/D Line**: Money flow tracking for trend confirmation
### 📉 VWAP Integration
- **Real-Time VWAP**: Orange cross-style line
- **Deviation %**: Distance from VWAP in info table
- **Extreme Deviation Alerts**: Triggers at ±3%
### 🔍 Divergence Detection
- **Bullish Divergence** 💎: Price ↓ + Volume ↓ (reversal signal)
- **Bearish Divergence** 💎: Price ↑ + Volume ↓ (reversal signal)
- **Auto-Detection**: Marks divergences with diamond shapes
### 📋 Enhanced Info Table
**13 Real-Time Metrics:**
1. MA Type
2. Channel Position (0-100% gradient)
3. RSI (color-coded)
4. Vol 1H/24H/7D (with trends)
5. VWAP Deviation
6. Volume Momentum
7. OBV Signal
8. POC Price
9. Volume Profile
10. Market State
### 🔔 12 Configurable Alerts
- Band crossovers (4 alerts)
- Overbought/Oversold conditions
- Volume spikes & OBV changes
- Divergences
- VWAP extreme deviations
---
## 🔧 Key Improvements
### Bug Fixes
- ✅ Fixed TEMA calculation syntax error (line 107)
- ✅ Removed tuple destructuring for v6 compatibility
- ✅ Replaced `hline()` with `plot()` for dynamic POC
- ✅ Added bar_index validation (prevents "historical data too far" error)
- ✅ Fixed volume color function return statement
### Performance
- ✅ Extracted `ta.sma()` from ternary operators for consistency
- ✅ Optimized Volume Profile calculation with conditional execution
- ✅ Added division by zero protection
- ✅ Early bar handling for all calculations
### Code Quality
- ✅ Modular function architecture
- ✅ Type-safe calculations
- ✅ Comprehensive error handling
- ✅ Clear documentation
---
## 📝 New Configuration Options
```pine
Enable Advanced Volume Analysis (default: true)
Volume MA Length (default: 20)
Volume Trend Length (default: 5)
Volume Profile Levels (5-20, default: 10)
Volume Profile Lookback (default: 100)
Show VWAP (default: true)
Show Divergences (default: true)
```
---
## 💡 Quick Usage Guide
### Volume Analysis
- **Green volume (>150%)**: Strong buying/selling pressure
- **Red volume (<50%)**: Weak participation
- **↑ arrow**: Volume trending up
- **OBV Accumulation**: Bullish sign
- **OBV Distribution**: Bearish sign
### POC & Volume Profile
- **POC above price**: Resistance area
- **POC below price**: Support area
- **█ in profile**: High volume zone (strong S/R)
- **░ in profile**: Low volume zone (weak S/R)
### Divergences
- **Bullish 💎 + oversold**: Strong buy setup
- **Bearish 💎 + overbought**: Strong sell setup
- **Volume spike + divergence**: High probability reversal
### VWAP Trading
- **Price > VWAP + positive deviation**: Overbought zone
- **Price < VWAP + negative deviation**: Oversold zone
- **>3% deviation**: Extreme - mean reversion likely
---
## 🎨 Visual Changes
- Gradient channel position coloring (Green → Yellow → Red)
- Dynamic bar coloring for overbought/oversold
- POC line with circles style
- Diamond markers for divergences
- ASCII volume profile in table
---
## 📊 Recommended Settings
**Crypto**: MA=14-20, Vol MA=14, Offset=±0.5%
**Forex**: MA=20-34, Vol MA=20, Offset=±0.3%
**Stocks**: MA=20-50, Vol MA=20-30, Offset=±0.2%
---
## 🔮 Coming Soon (v2.1)
- Multi-timeframe channel overlay
- Volume heatmap
- Custom alert builder
- Strategy backtesting
- Export to CSV
---
**Happy Trading! 📈**
*Use proper risk management. No indicator guarantees profit
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。