OPEN-SOURCE SCRIPT
Zaktualizowano

TRI - Linear Regression Channels

169
DESCRIPTION:
Advanced Linear Regression Channel indicator with comprehensive breakout detection
and alert system. Provides visual representation of price trends using statistical
regression analysis with customizable bands, channels, and future projections.

This indicator calculates linear regression lines based on price action and creates
dynamic channels that adapt to market volatility. It includes multiple visualization
modes, breakout detection, and an extensive alert system for trading opportunities.

KEY FEATURES:
  • Linear Regression Bands: Upper, middle, and lower bands based on regression analysis
  • Regression Channel: Alternative channel visualization with deviation bands
  • Future Projection: Extends regression channel into the future for trend prediction
  • Breakout Detection: Real-time detection of price breakouts above/below key levels
  • Confirmed Breakouts: Validates breakouts using previous bar confirmation
  • Pivot Markers: Visual markers for pivot points outside channel boundaries
  • Comprehensive Alerts: Multiple alert types for different breakout scenarios
  • Customizable Colors: Full control over line colors and fill transparency
  • Flat Color Fills: Non-gradient background fills for clean visualization


CREDITS & ATTRIBUTION:
Based on the "Linear Regression Channel" indicator by ChartPrime.
Original work licensed under Mozilla Public License 2.0.

IMPROVEMENTS & DIFFERENCES FROM ORIGINAL:

1. Enhanced Alert System:
  • Added comprehensive breakout alerts for mid line, support, and resistance
  • Implemented confirmed breakout detection using previous bar validation
  • Separate alerts for bullish and bearish breakouts
  • Real-time and confirmed breakout alerts for better signal quality


2. Improved Visualization:
  • Flat color fills without gradients for cleaner appearance
  • Customizable line colors with separate controls for upper/lower/mid lines
  • Color coordination: lines match their respective fill colors with less transparency
  • Better visual organization with meaningful plot names


3. Performance Optimizations:
  • Pre-calculated common conditions to reduce redundant evaluations
  • Optimized RMA calculation (calculated once instead of twice)
  • Streamlined alert logic to eliminate redundant checks
  • Better code organization for improved execution efficiency


4. Code Quality:
  • Reorganized code structure for better readability and maintainability
  • Clear separation of concerns (calculations, detection, alerts, visualization)
  • Consistent naming conventions and code formatting
  • Comprehensive comments and documentation


5. Additional Features:
  • Pivot-based breakout markers with directional triangles
  • Support for multiple channel modes (bands, channel, future projection)
  • Arrow direction indicator for trend visualization
  • Configurable extension periods for channels


USAGE:
1. Enable Linear Regression Bands for standard upper/mid/lower visualization
2. Use Regression Channel for alternative channel display with deviation bands
3. Enable Future Projection to see where the channel may extend
4. Configure alerts in TradingView alert settings for breakout notifications
5. Customize colors to match your trading style and chart theme

ALERT TYPES:
  • Mid Line Breakout: Price crosses the middle regression line
  • Support Breakout: Price breaks below the lower band
  • Resistance Breakout: Price breaks above the upper band
  • Confirmed Breakouts: Validated breakouts using previous bar confirmation
  • Pivot Markers: Visual indicators when pivots occur outside channel boundaries
Informacje o Wersji
DESCRIPTION:
Advanced Linear Regression Channel indicator with comprehensive breakout detection
and alert system. Provides visual representation of price trends using statistical
regression analysis with customizable bands, channels, and future projections.

This indicator calculates linear regression lines based on price action and creates
dynamic channels that adapt to market volatility. It includes multiple visualization
modes, breakout detection, and an extensive alert system for trading opportunities.

KEY FEATURES:
  • Linear Regression Bands: Upper, middle, and lower bands based on regression analysis
  • Regression Channel: Alternative channel visualization with deviation bands
  • Future Projection: Extends regression channel into the future for trend prediction
  • Breakout Detection: Real-time detection of price breakouts above/below key levels
  • Pivot Markers: Visual markers for pivot points outside channel boundaries
  • Comprehensive Alerts: Multiple alert types for different breakout scenarios
  • Customizable Colors: Full control over line colors and fill transparency
  • Flat Color Fills: Non-gradient background fills for clean visualization


CREDITS & ATTRIBUTION:
Based on the "Linear Regression Channel" indicator by ChartPrime.
Original work licensed under Mozilla Public License 2.0.

IMPROVEMENTS & DIFFERENCES FROM ORIGINAL:

1. Enhanced Alert System:
  • Configurable alertcondition system for flexible alert management
  • Separate alerts for lower band, upper band, and middle band breakouts
  • Bullish and bearish middle band breakout alerts
  • Aggregated alert for upper or lower band breakouts
  • Real-time breakout detection for immediate signal alerts


2. Improved Visualization:
  • Flat color fills without gradients for cleaner appearance
  • Customizable line colors with separate controls for upper/lower/mid lines
  • Color coordination: lines match their respective fill colors with less transparency
  • Better visual organization with meaningful plot names


3. Performance Optimizations:
  • Pre-calculated common conditions to reduce redundant evaluations
  • Optimized RMA calculation (calculated once instead of twice)
  • Streamlined alert logic to eliminate redundant checks
  • Better code organization for improved execution efficiency


4. Code Quality:
  • Reorganized code structure for better readability and maintainability
  • Clear separation of concerns (calculations, detection, alerts, visualization)
  • Consistent naming conventions and code formatting
  • Comprehensive comments and documentation


5. Additional Features:
  • Pivot-based breakout markers with directional triangles
  • Support for multiple channel modes (bands, channel, future projection)
  • Arrow direction indicator for trend visualization
  • Configurable extension periods for channels


USAGE:
1. Enable Linear Regression Bands for standard upper/mid/lower visualization
2. Use Regression Channel for alternative channel display with deviation bands
3. Enable Future Projection to see where the channel may extend
4. Configure alerts in TradingView alert settings for breakout notifications
5. Customize colors to match your trading style and chart theme

ALERT TYPES:
  • Lower Band Breakout: Alert when price crosses the lower regression band
  • Upper Band Breakout: Alert when price crosses the upper regression band
  • Upper or Lower Band Breakout: Alert when price crosses either band
  • Bullish Middle Band Breakout: Alert when price crosses the middle line upward
  • Bearish Middle Band Breakout: Alert when price crosses the middle line downward
  • Pivot Markers: Visual indicators when pivots occur outside channel boundaries
Informacje o Wersji
DESCRIPTION:
Advanced Linear Regression Channel indicator with comprehensive breakout detection
and alert system. Provides visual representation of price trends using statistical
regression analysis with customizable bands, channels, and future projections.

This indicator calculates linear regression lines based on price action and creates
dynamic channels that adapt to market volatility. It includes multiple visualization
modes, breakout detection, re-entry alerts, and an extensive alertcondition system
for flexible trading opportunity notifications.

KEY FEATURES:
  • Linear Regression Bands: Upper, middle, and lower bands based on regression analysis
  • Regression Channel: Alternative channel visualization with deviation bands
  • Future Projection: Extends regression channel into the future for trend prediction
  • Breakout Detection: Real-time detection of price breakouts above/below key levels
  • Re-Entry Detection: Alerts when price re-enters inside bands after breaking out
  • Pivot Markers: Visual markers for pivot points outside channel boundaries
  • Comprehensive Alerts: Multiple alertcondition types for flexible alert management
  • Customizable Colors: Full control over line colors and fill transparency
  • Flat Color Fills: Non-gradient background fills for clean visualization


CREDITS & ATTRIBUTION:
Based on the "Linear Regression Channel" indicator by ChartPrime.
Original work licensed under Mozilla Public License 2.0.

IMPROVEMENTS & DIFFERENCES FROM ORIGINAL:

1. Enhanced Alert System:
  • Configurable alertcondition system for flexible alert management
  • Separate alerts for lower band, upper band, and middle band breakouts
  • Bullish and bearish middle band breakout alerts
  • Aggregated alert for upper or lower band breakouts
  • Band re-entry alerts when price returns inside bands after breakout
  • Separate re-entry alerts for upper, lower, and combined band re-entries
  • Real-time breakout and re-entry detection for immediate signal alerts


2. Improved Visualization:
  • Flat color fills without gradients for cleaner appearance
  • Customizable line colors with separate controls for upper/lower/mid lines
  • Color coordination: lines match their respective fill colors with less transparency
  • Better visual organization with meaningful plot names


3. Performance Optimizations:
  • Pre-calculated common conditions to reduce redundant evaluations
  • Optimized RMA calculation (calculated once instead of twice)
  • Streamlined alert logic to eliminate redundant checks
  • Better code organization for improved execution efficiency


4. Code Quality:
  • Reorganized code structure for better readability and maintainability
  • Clear separation of concerns (calculations, detection, alerts, visualization)
  • Consistent naming conventions and code formatting
  • Comprehensive comments and documentation


5. Additional Features:
  • Pivot-based breakout markers with directional triangles
  • Support for multiple channel modes (bands, channel, future projection)
  • Arrow direction indicator for trend visualization
  • Configurable extension periods for channels


USAGE:
1. Enable Linear Regression Bands for standard upper/mid/lower visualization
2. Use Regression Channel for alternative channel display with deviation bands
3. Enable Future Projection to see where the channel may extend
4. Configure alerts in TradingView alert settings for breakout notifications
5. Customize colors to match your trading style and chart theme

ALERT TYPES:
  • Lower Band Breakout: Alert when price crosses the lower regression band
  • Upper Band Breakout: Alert when price crosses the upper regression band
  • Upper or Lower Band Breakout: Alert when price crosses either band
  • Bullish Middle Band Breakout: Alert when price crosses the middle line upward
  • Bearish Middle Band Breakout: Alert when price crosses the middle line downward
  • Upper Band Re-Entry: Alert when price re-enters inside the upper band
  • Lower Band Re-Entry: Alert when price re-enters inside the lower band
  • Upper or Lower Band Re-Entry: Alert when price re-enters inside either band
  • Pivot Markers: Visual indicators when pivots occur outside channel boundaries

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.