PROTECTED SOURCE SCRIPT
Positive/Negative Close Counter (Bar-Based)

# Positive/Negative Close Counter (Bar-Based)
## Overview
This indicator analyzes the historical performance of an asset by counting positive and negative closing price movements over a specified lookback period. It provides statistical insights into the directional bias of price action, helping traders understand the historical tendency of an instrument to close higher or lower compared to the previous period.
## Key Features
- **Multi-Timeframe Analysis**: Supports Daily (D) and Weekly (W) timeframe analysis
- **Customizable Lookback Period**: Adjustable lookback period with default setting of 252 bars (approximately 1 trading year for daily charts)
- **Flexible Display Options**: Choose from 5 different label positions on the chart for optimal visibility
- **Real-Time Statistics**: Displays count of positive closes, negative closes, and percentage of positive movements
- **Clean Visual Presentation**: Information displayed in a clear, organized label with emojis for easy reading
## Input Parameters
1. **Timeframe**: Select between Daily or Weekly analysis
2. **Lookback Period**: Number of bars to analyze (default: 252 bars)
3. **Display Box Location**: Choose label position from Top Left, Top Right, Bottom Left, Bottom Middle, or Bottom Right
## What It Shows
The indicator displays:
- Current timeframe being analyzed
- Number of bars in the lookback period
- Count of periods where the close was higher than the previous close (Positive Closes)
- Count of periods where the close was lower than the previous close (Negative Closes)
- Percentage of positive closing periods
## Technical Implementation
- Uses Pine Script v5 for optimal performance
- Implements security() function for multi-timeframe data requests
- Employs dynamic label positioning based on visible price range
- Handles edge cases with proper null value checking
## Important Notes
- The indicator only counts closes that are definitively higher or lower than the previous close
- Unchanged closes (equal prices) are not counted in either category
- Results are based on historical data and do not predict future performance
- Works on all chart timeframes but analyzes data according to the selected timeframe parameter
This tool is designed for educational and analytical purposes to help traders better understand price behavior patterns in their chosen instruments.
## Overview
This indicator analyzes the historical performance of an asset by counting positive and negative closing price movements over a specified lookback period. It provides statistical insights into the directional bias of price action, helping traders understand the historical tendency of an instrument to close higher or lower compared to the previous period.
## Key Features
- **Multi-Timeframe Analysis**: Supports Daily (D) and Weekly (W) timeframe analysis
- **Customizable Lookback Period**: Adjustable lookback period with default setting of 252 bars (approximately 1 trading year for daily charts)
- **Flexible Display Options**: Choose from 5 different label positions on the chart for optimal visibility
- **Real-Time Statistics**: Displays count of positive closes, negative closes, and percentage of positive movements
- **Clean Visual Presentation**: Information displayed in a clear, organized label with emojis for easy reading
## Input Parameters
1. **Timeframe**: Select between Daily or Weekly analysis
2. **Lookback Period**: Number of bars to analyze (default: 252 bars)
3. **Display Box Location**: Choose label position from Top Left, Top Right, Bottom Left, Bottom Middle, or Bottom Right
## What It Shows
The indicator displays:
- Current timeframe being analyzed
- Number of bars in the lookback period
- Count of periods where the close was higher than the previous close (Positive Closes)
- Count of periods where the close was lower than the previous close (Negative Closes)
- Percentage of positive closing periods
## Technical Implementation
- Uses Pine Script v5 for optimal performance
- Implements security() function for multi-timeframe data requests
- Employs dynamic label positioning based on visible price range
- Handles edge cases with proper null value checking
## Important Notes
- The indicator only counts closes that are definitively higher or lower than the previous close
- Unchanged closes (equal prices) are not counted in either category
- Results are based on historical data and do not predict future performance
- Works on all chart timeframes but analyzes data according to the selected timeframe parameter
This tool is designed for educational and analytical purposes to help traders better understand price behavior patterns in their chosen instruments.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 제한 없이 자유롭게 사용할 수 있습니다 — 여기에서 자세히 알아보기.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 제한 없이 자유롭게 사용할 수 있습니다 — 여기에서 자세히 알아보기.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.