PROTECTED SOURCE SCRIPT

Circuit Counter (1Y)

64
# Circuit Counter (1Y) - Pine Script Indicator

## Overview
The Circuit Counter (1Y) is a comprehensive technical analysis tool designed to track and count circuit breaker events over a rolling 12-month period (252 trading bars). This indicator helps traders identify stocks or securities that frequently hit upper or lower circuit limits, providing valuable insights into price volatility patterns and market behavior.

## Key Features

### Circuit Detection Algorithm
- **Precision Tracking**: Monitors exact 5%, 10%, and 20% price movements with high accuracy (0.01% tolerance)
- **Upper Circuit Detection**: Identifies when closing price equals daily high AND represents a 5%, 10%, or 20% gain
- **Lower Circuit Detection**: Identifies when closing price equals daily low AND represents a 5%, 10%, or 20% loss
- **Real-time Analysis**: Continuously updates circuit counts as new bars form

### Visual Display
- **Clean Table Interface**: Displays circuit counts in an organized table positioned at bottom-right of chart
- **Color-coded Results**: Green background for upper circuits, red background for lower circuits
- **Professional Formatting**: White text on colored backgrounds for optimal readability
- **Non-intrusive Design**: Overlay indicator that doesn't interfere with price action analysis

### Customization Options
- **Adjustable Lookback Period**: Default 252 bars (1 trading year) with flexibility to modify based on analysis needs
- **Minimum Value Protection**: Input validation ensures lookback period cannot be set below 1 bar

## Technical Specifications
- **Version**: Pine Script v5
- **Chart Type**: Overlay indicator
- **Performance**: Optimized loop structure for efficient historical data processing
- **Compatibility**: Works on all timeframes and asset classes
- **Memory Management**: Uses variable declarations for optimal performance

*This indicator is designed for educational and analytical purposes. Past circuit breaker activity does not guarantee future performance or price movements.*

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.