OPEN-SOURCE SCRIPT
Scalper - Pattern Recognition & Price Action with Divergence

Scalper - Pattern Recognition & Price Action with Divergence
Overview
An educational indicator designed to demonstrate comprehensive technical analysis concepts through integrated pattern recognition, price action analysis, and divergence detection. This tool combines traditional candlestick patterns with modern institutional concepts and advanced divergence analysis for educational market study.
Educational Purpose & Originality
Core Educational Concepts
This indicator serves as a learning platform for understanding:
- **Pattern Recognition Methodology**: Systematic identification of candlestick formations
- **Price Action Theory**: Modern institutional footprint analysis
- **Divergence Analysis**: Momentum divergence detection across multiple oscillators
- **Confluence Systems**: Multi-signal integration and validation techniques
Original Implementation Features
1. Enhanced Pattern Detection Library
- **Volatility-Filtered Patterns**: ATR-based validation for pattern significance
- **Volume-Confirmed Formations**: Integration of volume analysis with pattern detection
- **Multi-Candle Pattern Recognition**: Three-candle formations and complex patterns
- **Context-Aware Detection**: Patterns validated against market structure
2. Advanced Divergence System
- **Multi-Oscillator Analysis**: RSI, CCI, and MACD divergence detection
- **Four Divergence Types**: Regular bullish/bearish and hidden bullish/bearish
- **Pivot-Based Detection**: Systematic swing high/low identification
- **Weighted Signal Integration**: Divergences integrated into confluence scoring
3. Modern Price Action Concepts
- **Fair Value Gaps (FVG)**: Identification of institutional inefficiencies
- **Order Block Detection**: Volume-validated accumulation/distribution zones
- **Dynamic Support/Resistance**: Touch-count validated levels with ATR tolerance
- **Breakout Analysis**: Volume-confirmed price breakouts
4. Intelligent Confluence System
- **Multi-Signal Aggregation**: Combines patterns, oscillators, divergences, and breakouts
- **Weighted Scoring Algorithm**: Different signal types receive appropriate weighting
- **Visual Confluence Display**: Clear indication of high-probability setups
- **Reason Tracking**: Shows which signals contribute to confluence
How to Use
Initial Configuration
1. **Enable Desired Components**: Toggle individual analysis modules based on learning focus
2. **Adjust Sensitivity Settings**: Configure pattern detection parameters for your market
3. **Select Divergence Options**: Choose oscillators and divergence types to monitor
4. **Set Confluence Requirements**: Define minimum signals needed for confirmation
Component Settings
Moving Average Configuration
- Four customizable MA lines for multi-timeframe trend analysis
- Selectable MA types (SMA, EMA, WMA, VWMA, HMA)
- Independent timeframe settings for each MA
Pattern Recognition Settings
- **Engulfing Patterns**: Strong engulfing with ATR validation
- **Doji Variations**: Standard, gravestone, and dragonfly detection
- **Hammer/Hanging Man**: Context-validated reversal patterns
- **Star Formations**: Morning and evening star patterns
- **Three Soldiers/Crows**: Momentum continuation patterns
Divergence Detection Parameters
- **Lookback Period**: Adjustable swing detection range
- **Minimum Pivot Strength**: Percentage threshold for valid pivots
- **Oscillator Selection**: RSI, CCI, MACD, or combination
- **Divergence Types**: Regular and hidden divergences
Signal Interpretation
Visual Indicators
- **Pattern Labels**: Clear marking of detected formations
- **Divergence Lines**: Visual connection between price and oscillator pivots
- **Support/Resistance Levels**: Dynamic horizontal levels with validation
- **Confluence Signals**: Large "BULL" or "BEAR" labels for high-probability setups
Dashboard Information
- Real-time oscillator values (RSI, CCI, MACD)
- Current signal count for bulls and bears
- Active divergence status
- Confluence confirmation status
Important Educational Considerations
Learning Focus
- **Pattern Study**: Understand how traditional patterns form and their limitations
- **Divergence Concepts**: Learn to identify momentum shifts before price reversals
- **Confluence Theory**: Practice combining multiple analysis techniques
- **Risk Awareness**: No pattern or signal guarantees future price movement
Limitations for Learning
- **Historical Analysis**: Patterns are identified after formation
- **No Predictive Guarantee**: Educational tool for understanding concepts, not predictions
- **Market Context Required**: Patterns should be considered within broader market context
- **Practice Required**: Effective use requires study and practice
Educational Best Practices
1. **Start Simple**: Enable one component at a time to understand each concept
2. **Paper Trade**: Practice identifying signals without real money risk
3. **Study Failed Signals**: Learn why patterns fail to improve understanding
4. **Combine with Other Analysis**: Use alongside fundamental and sentiment analysis
5. **Document Observations**: Keep a journal of pattern occurrences and outcomes
Technical Components
Indicator Architecture
- **Modular Design**: Independent modules for different analysis types
- **Performance Optimization**: Efficient calculation methods for smooth operation
- **Visual Management**: Controlled use of Pine Script drawing objects
- **Array-Based Storage**: Efficient data management for historical analysis
Calculation Methods
- **ATR-Based Validation**: Volatility-adjusted pattern filtering
- **Volume Analysis**: Comparative volume assessment for confirmation
- **Pivot Detection**: Mathematical identification of swing points
- **Statistical Validation**: Touch-count and tolerance-based S/R levels
Divergence Detection Methodology
Regular Divergences (Reversal Signals)
- **Bullish**: Price lower low + Oscillator higher low
- **Bearish**: Price higher high + Oscillator lower high
Hidden Divergences (Continuation Signals)
- **Hidden Bullish**: Price higher low + Oscillator lower low
- **Hidden Bearish**: Price lower high + Oscillator higher high
Validation Criteria
- Minimum pivot strength requirement (percentage-based)
- Lookback period for swing detection
- Multiple oscillator confirmation option
Confluence Scoring System
Signal Categories
1. **Pattern Signals** (Weight: 1): Candlestick formations
2. **Oscillator Signals** (Weight: 1): RSI/CCI extremes
3. **Breakout Signals** (Weight: 1): Volume-confirmed breaks
4. **Regular Divergences** (Weight: 2): Higher probability reversals
5. **Hidden Divergences** (Weight: 1): Trend continuation signals
Confluence Thresholds
- Adjustable minimum signal requirement (2-6 signals)
- Visual indication when threshold is met
- Detailed reason display for educational understanding
Educational Dashboard
Real-Time Metrics
- Oscillator readings (RSI, CCI, MACD)
- ATR volatility measurement
- Bull/Bear signal counts
- Divergence status
- Confluence confirmation
Customization Options
- Position selection (6 screen locations)
- Color customization for all elements
- Enable/disable individual components
Version Information
- **Version 1.1**: Added comprehensive divergence detection system
- **Educational Focus**: Designed for learning technical analysis concepts
- **Integration**: All components work together in confluence system
Disclaimer
This indicator is designed exclusively for educational purposes to demonstrate technical analysis concepts. It is not financial advice and should not be used as the sole basis for trading decisions. Past patterns and signals do not guarantee future results. Trading involves substantial risk of loss. Users should conduct their own research, practice with demo accounts, and consider seeking advice from qualified professionals before making investment decisions.
Learning Resources
The indicator includes extensive inline comments explaining each calculation and concept. Users are encouraged to study the source code to understand the methodology behind each component. This transparency aids in learning how technical indicators work and their limitations.
---
**Note**: This is an educational tool meant to help traders learn pattern recognition and technical analysis concepts. Success requires practice, additional analysis, and proper risk management.
Overview
An educational indicator designed to demonstrate comprehensive technical analysis concepts through integrated pattern recognition, price action analysis, and divergence detection. This tool combines traditional candlestick patterns with modern institutional concepts and advanced divergence analysis for educational market study.
Educational Purpose & Originality
Core Educational Concepts
This indicator serves as a learning platform for understanding:
- **Pattern Recognition Methodology**: Systematic identification of candlestick formations
- **Price Action Theory**: Modern institutional footprint analysis
- **Divergence Analysis**: Momentum divergence detection across multiple oscillators
- **Confluence Systems**: Multi-signal integration and validation techniques
Original Implementation Features
1. Enhanced Pattern Detection Library
- **Volatility-Filtered Patterns**: ATR-based validation for pattern significance
- **Volume-Confirmed Formations**: Integration of volume analysis with pattern detection
- **Multi-Candle Pattern Recognition**: Three-candle formations and complex patterns
- **Context-Aware Detection**: Patterns validated against market structure
2. Advanced Divergence System
- **Multi-Oscillator Analysis**: RSI, CCI, and MACD divergence detection
- **Four Divergence Types**: Regular bullish/bearish and hidden bullish/bearish
- **Pivot-Based Detection**: Systematic swing high/low identification
- **Weighted Signal Integration**: Divergences integrated into confluence scoring
3. Modern Price Action Concepts
- **Fair Value Gaps (FVG)**: Identification of institutional inefficiencies
- **Order Block Detection**: Volume-validated accumulation/distribution zones
- **Dynamic Support/Resistance**: Touch-count validated levels with ATR tolerance
- **Breakout Analysis**: Volume-confirmed price breakouts
4. Intelligent Confluence System
- **Multi-Signal Aggregation**: Combines patterns, oscillators, divergences, and breakouts
- **Weighted Scoring Algorithm**: Different signal types receive appropriate weighting
- **Visual Confluence Display**: Clear indication of high-probability setups
- **Reason Tracking**: Shows which signals contribute to confluence
How to Use
Initial Configuration
1. **Enable Desired Components**: Toggle individual analysis modules based on learning focus
2. **Adjust Sensitivity Settings**: Configure pattern detection parameters for your market
3. **Select Divergence Options**: Choose oscillators and divergence types to monitor
4. **Set Confluence Requirements**: Define minimum signals needed for confirmation
Component Settings
Moving Average Configuration
- Four customizable MA lines for multi-timeframe trend analysis
- Selectable MA types (SMA, EMA, WMA, VWMA, HMA)
- Independent timeframe settings for each MA
Pattern Recognition Settings
- **Engulfing Patterns**: Strong engulfing with ATR validation
- **Doji Variations**: Standard, gravestone, and dragonfly detection
- **Hammer/Hanging Man**: Context-validated reversal patterns
- **Star Formations**: Morning and evening star patterns
- **Three Soldiers/Crows**: Momentum continuation patterns
Divergence Detection Parameters
- **Lookback Period**: Adjustable swing detection range
- **Minimum Pivot Strength**: Percentage threshold for valid pivots
- **Oscillator Selection**: RSI, CCI, MACD, or combination
- **Divergence Types**: Regular and hidden divergences
Signal Interpretation
Visual Indicators
- **Pattern Labels**: Clear marking of detected formations
- **Divergence Lines**: Visual connection between price and oscillator pivots
- **Support/Resistance Levels**: Dynamic horizontal levels with validation
- **Confluence Signals**: Large "BULL" or "BEAR" labels for high-probability setups
Dashboard Information
- Real-time oscillator values (RSI, CCI, MACD)
- Current signal count for bulls and bears
- Active divergence status
- Confluence confirmation status
Important Educational Considerations
Learning Focus
- **Pattern Study**: Understand how traditional patterns form and their limitations
- **Divergence Concepts**: Learn to identify momentum shifts before price reversals
- **Confluence Theory**: Practice combining multiple analysis techniques
- **Risk Awareness**: No pattern or signal guarantees future price movement
Limitations for Learning
- **Historical Analysis**: Patterns are identified after formation
- **No Predictive Guarantee**: Educational tool for understanding concepts, not predictions
- **Market Context Required**: Patterns should be considered within broader market context
- **Practice Required**: Effective use requires study and practice
Educational Best Practices
1. **Start Simple**: Enable one component at a time to understand each concept
2. **Paper Trade**: Practice identifying signals without real money risk
3. **Study Failed Signals**: Learn why patterns fail to improve understanding
4. **Combine with Other Analysis**: Use alongside fundamental and sentiment analysis
5. **Document Observations**: Keep a journal of pattern occurrences and outcomes
Technical Components
Indicator Architecture
- **Modular Design**: Independent modules for different analysis types
- **Performance Optimization**: Efficient calculation methods for smooth operation
- **Visual Management**: Controlled use of Pine Script drawing objects
- **Array-Based Storage**: Efficient data management for historical analysis
Calculation Methods
- **ATR-Based Validation**: Volatility-adjusted pattern filtering
- **Volume Analysis**: Comparative volume assessment for confirmation
- **Pivot Detection**: Mathematical identification of swing points
- **Statistical Validation**: Touch-count and tolerance-based S/R levels
Divergence Detection Methodology
Regular Divergences (Reversal Signals)
- **Bullish**: Price lower low + Oscillator higher low
- **Bearish**: Price higher high + Oscillator lower high
Hidden Divergences (Continuation Signals)
- **Hidden Bullish**: Price higher low + Oscillator lower low
- **Hidden Bearish**: Price lower high + Oscillator higher high
Validation Criteria
- Minimum pivot strength requirement (percentage-based)
- Lookback period for swing detection
- Multiple oscillator confirmation option
Confluence Scoring System
Signal Categories
1. **Pattern Signals** (Weight: 1): Candlestick formations
2. **Oscillator Signals** (Weight: 1): RSI/CCI extremes
3. **Breakout Signals** (Weight: 1): Volume-confirmed breaks
4. **Regular Divergences** (Weight: 2): Higher probability reversals
5. **Hidden Divergences** (Weight: 1): Trend continuation signals
Confluence Thresholds
- Adjustable minimum signal requirement (2-6 signals)
- Visual indication when threshold is met
- Detailed reason display for educational understanding
Educational Dashboard
Real-Time Metrics
- Oscillator readings (RSI, CCI, MACD)
- ATR volatility measurement
- Bull/Bear signal counts
- Divergence status
- Confluence confirmation
Customization Options
- Position selection (6 screen locations)
- Color customization for all elements
- Enable/disable individual components
Version Information
- **Version 1.1**: Added comprehensive divergence detection system
- **Educational Focus**: Designed for learning technical analysis concepts
- **Integration**: All components work together in confluence system
Disclaimer
This indicator is designed exclusively for educational purposes to demonstrate technical analysis concepts. It is not financial advice and should not be used as the sole basis for trading decisions. Past patterns and signals do not guarantee future results. Trading involves substantial risk of loss. Users should conduct their own research, practice with demo accounts, and consider seeking advice from qualified professionals before making investment decisions.
Learning Resources
The indicator includes extensive inline comments explaining each calculation and concept. Users are encouraged to study the source code to understand the methodology behind each component. This transparency aids in learning how technical indicators work and their limitations.
---
**Note**: This is an educational tool meant to help traders learn pattern recognition and technical analysis concepts. Success requires practice, additional analysis, and proper risk management.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.