The script identifies and manages bar ranges, which are defined as bars where the high and low prices are fully contained within the high and low of the previous bar. These ranges are used by traders to identify potential breakouts and price consolidations.
2. Key Features
Active Range Validation
A potential range becomes an active range when the price breaks out of the bar’s high or low. The breakout direction is tracked: • Upward breakout: When the price closes above the high of the range. • Downward breakout: When the price closes below the low of the range.
The script creates: • Lines to represent the high and low of the range. • A colored background box to indicate the range, with color coded for breakout direction: • Green: Upward breakout. • Orange: Downward breakout.
Range Updates • Exit Detection: The script detects if the price exits the range (moves outside the high or low levels). • Reintegration and Mitigation: • If the price re-enters an exited range, it marks the range as “mitigated.” • The lines for mitigated ranges are updated (color and width are changed). • The background box is removed for mitigated ranges.
3. User Inputs
The script provides customization options: • Breakout Colors: • upBreakoutColor: Background color for upward breakout ranges (default: semi-transparent green). • downBreakoutColor: Background color for downward breakout ranges (default: semi-transparent orange). • Mitigated Range Styling: • mitigatedLineColor: Line color for mitigated ranges (default: red). • mitigatedLineWidth: Width of the line for mitigated ranges. • Line and Background Settings: • activeLineWidth: Width of lines for active ranges. • lineExtension: Length of line extensions beyond the range’s initial boundaries. • Range Display Limits: • maxActiveRanges: Maximum number of active ranges to display on the chart (default: up to 200).
4. Visualization
The script provides clear visual feedback for identified ranges: • Lines: High and low levels of the range are drawn as lines on the chart. • Background Boxes: Colored boxes are drawn to represent active ranges, with breakout direction indicated by the box’s color. • Mitigation Styling: Mitigated ranges have updated line styles and no background.
5. Range Management
The script actively manages ranges: • Tracks the status of each range (active, exited, reintegrated, mitigated). • Limits the number of displayed ranges to improve chart readability and comply with TradingView’s object limits.
6. Use Case
This script is ideal for traders who: • Use inside bars to identify areas of consolidation and breakout opportunities. • Want to track active and mitigated ranges automatically. • Need a clear, visual representation of ranges and breakout directions.
7. Limitations • Inside bars are identified based only on the current and previous bar, so the script might not detect more complex consolidation patterns. • The maximum number of ranges displayed is limited to the user-defined value (maxActiveRanges), with a hard limit of 200 due to TradingView’s object restrictions.
Este script é publicado como de código fechado e você pode usá-lo livremente. Você pode favoritá-lo para utilizá-lo em um gráfico. Você não pode visualizar ou modificar seu código fonte.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.