OPEN-SOURCE SCRIPT
MACD with Smart Entry Signals & Trend Filter

This advanced MACD indicator combines traditional MACD analysis with intelligent entry signal detection and an optional EMA trend filter. It identifies high-probability entry points by analyzing histogram patterns, consolidation phases, and trend continuation setups.
### Key Features
**🎯 Smart Entry Detection**
- **Consolidation Breakouts**: Identifies exits from consolidation zones (weak bars) with strong momentum
- **Trend Reversals**: Detects potential trend changes after extended weak phases
- **Correction/Continuation Patterns**: Recognizes brief corrections within strong trends that offer continuation opportunities
**📊 Enhanced MACD Visualization**
- Color-coded histogram showing four distinct states:
- Strong Bullish (dark green): Rising histogram above zero
- Weak Bullish (light green): Falling histogram above zero
- Weak Bearish (light red): Rising histogram below zero
- Strong Bearish (dark red): Falling histogram below zero
**🔍 Multi-Layer Filtering System**
- **Candle Size Filter**: Eliminates signals during high volatility/large candle ranges
- **EMA Trend Filter**: Optional filter ensuring entries align with the dominant trend direction
- Visual markers for rejected signals (orange X for candle size, blue E for EMA trend)
**⚙️ Customizable Parameters**
- Adjustable MACD periods (default: 34/144/9)
- Configurable consolidation bar requirements
- Flexible correction pattern detection
- EMA trend filter with adjustable sensitivity
- Multiple alert types for all signal conditions
### How to Use
1. **Enable/disable filters** based on your trading style and market conditions
2. **Green triangles (L)**: Long entry signals when all conditions are met
3. **Red triangles (S)**: Short entry signals when all conditions are met
4. **Rejected signal markers**: Help you understand why certain setups were filtered out
5. **Background coloring**: Provides visual confirmation of signal zones and correction patterns
### Alert System
Comprehensive alerts for:
- Long and short entry signals
- Specific pattern types (consolidation, reversal, continuation)
- Rejected signals (helps refine strategy)
- Traditional MACD histogram crossovers
### Best Practices
- Use the EMA trend filter in trending markets to avoid counter-trend trades
- Adjust candle size filter based on your instrument's typical volatility
- Consider combining with support/resistance levels for confirmation
- Test different consolidation bar settings for your timeframe
### Parameters Summary
- Fast/Slow Length: MACD calculation periods
- Signal Smoothing: Signal line period
- Consolidation Bars: Minimum weak bars before breakout
- Max Candle Range: Filter for oversized candles
- EMA Period & Sensitivity: Trend filter configuration
---
*This indicator is designed for traders who want a systematic approach to identifying MACD-based entry opportunities with built-in risk management through filtering.*
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน