OPEN-SOURCE SCRIPT

Statistcal Daily Profile & Ranges

179
# Statistical Daily Profile & Ranges - TradingView Publication Guide

## Overview
The **Statistical Daily Profile & Ranges** indicator is a comprehensive tool designed to analyze intraday session behavior and daily range characteristics. It combines Average Daily Range (ADR) projection levels with detailed session-by-session statistics and probability-based trading insights derived from historical price action patterns.

## What This Indicator Does

This indicator provides traders with three core analytical components:

1. **ADR Projection Levels** - Dynamic support/resistance levels based on historical daily ranges
2. **Session Range Analysis** - Visual boxes and statistical breakdowns for four key trading sessions
3. **Dynamic Probability Display** - Real-time probability statistics based on overnight session relationships

## How It Works

### Average Daily Range (ADR) Calculation
The indicator calculates the average daily range over a user-defined lookback period (default: 10 days) and projects this range from each day's opening price. This creates two key levels:
- **ADR High**: Opening price + average daily range
- **ADR Low**: Opening price - average daily range
- **ADR Median**: The opening price (middle of the projected range)

These levels are recalculated at the start of each trading day and extend forward, providing dynamic support and resistance zones based on recent volatility characteristics.

### Session Tracking & Statistics
The indicator monitors four distinct trading sessions (times in Eastern Time):
1. **Asia Session** (8:00 PM - 2:00 AM)
2. **London Session** (2:00 AM - 8:00 AM)
3. **NY Open** (8:00 AM - 9:00 AM)
4. **NY Initial Balance** (9:30 AM - 10:30 AM)

For each session, the indicator:
- Draws a colored box showing the session's high-to-low range
- Tracks the opening price, high, and low
- Stores historical data for statistical analysis
- Calculates average ranges by day of week (Monday through Friday)

The session statistics are displayed in a customizable table showing average point ranges for each session across different weekdays, helping traders identify which sessions and days typically produce the most movement.

### Dynamic Probability System
The indicator analyzes the relationship between the Asia and London sessions to determine the current market setup. After the London session closes, it automatically detects one of four possible conditions:

**1. London Engulfs Asia**
- London session breaks both above Asia's high AND below Asia's low
- This indicates strong momentum during the European session
- Most common occurrence pattern

**2. Asia Engulfs London**
- Asia session range completely contains the London session range
- Indicates consolidation during London hours
- Relatively rare pattern (occurs approximately 5.36% of the time)

**3. London Partially Engulfs Upwards**
- London breaks above Asia's high but stays above Asia's low
- Suggests bullish momentum continuation from Asia into London

**4. London Partially Engulfs Downwards**
- London breaks below Asia's low but stays below Asia's high
- Suggests bearish momentum continuation from Asia into London

Once a condition is detected, the indicator displays a probability table showing historically observed outcomes for that specific setup, including:
- Probability of NY session taking out key levels (Asia high/low, London high/low)
- Probability of NY session engulfing the entire overnight range
- Directional bias for NY Cash session (9:30 AM - 4:00 PM)

## How to Use This Indicator

### Initial Setup
1. Add the indicator to your chart (works on any intraday timeframe below Daily)
2. Adjust the **ADR Days** setting (default: 10) to control the lookback period for range calculation
3. Adjust the **Session Lookback Days** setting (default: 50) to determine how much historical data feeds the statistics tables

### Reading the ADR Levels
- Use the **ADR High** and **ADR Low** lines as potential profit targets or areas where price may encounter resistance
- The **ADR Median** line represents the opening price and can act as a pivot point for intraday directional bias
- If price reaches the ADR High early in the session, it suggests strong bullish momentum; conversely for ADR Low
- These levels adapt daily based on recent volatility, making them more responsive than static levels

### Interpreting Session Boxes
- **Session boxes** visually highlight when each trading session is active and its price range
- Larger boxes indicate higher volatility during that session
- Compare current session ranges to the statistical averages shown in the table
- Sessions that are unusually quiet or active relative to historical averages may signal compression or expansion

### Using the Session Statistics Table
- The table shows average point ranges for each session broken down by weekday
- Identify which sessions typically produce the most movement on specific days
- For example, if London on Thursdays averages 40 points while Mondays average 25 points, you can adjust position sizing or expectations accordingly
- The **Total** column shows the overall average across all days
- Sample sizes (shown in brackets if enabled) indicate data reliability

### Trading with the Probability Table
The probability table updates dynamically after the London session closes and shows statistically probable outcomes based on 12 years of NQ futures data.

**Important Limitations:**
- **These probabilities are derived from NQ (Nasdaq E-mini futures) data only**
- **Do NOT apply these probability statistics to other instruments** (ES, stocks, forex, etc.)
- The probabilities represent historical frequencies, not guarantees
- Always combine with your own analysis, risk management, and market context

**How to Apply the Probabilities:**

When **London Engulfs Asia**:
- Watch for NY session to take out London's extremes (72.33% probability for high, 71.12% for low)
- Slight bullish bias in NY Cash session (54.80% vs 45.20%)
- Lower probability of complete overnight engulfment (44.13%)

When **Asia Engulfs London** (rare - 5.36% occurrence):
- Higher probability NY takes Asia's high (75.86%)
- Moderately high probability NY takes Asia's low (65.52%)
- Slight increase in bullish bias (58.42% vs 41.58%)
- Recognize this as an unusual setup

When **London Partially Engulfs Upwards**:
- Very high probability NY takes London high (81.51%)
- Strong probability NY takes London low (64.45%)
- Moderate probability NY takes Asian low (53.16%)
- Slight bullish bias (55.52%)

When **London Partially Engulfs Downwards**:
- Very high probability NY takes London low (75.29%)
- Strong probability NY takes London high (68.80%)
- Moderate probability NY takes Asian high (56.44%)
- Slight bullish bias maintained (52.99%)

### Practical Trading Applications

**Scenario 1: Range Projection**
If the ADR is 500 points and the market opens at 25,000:
- ADR High: 25,500 (potential resistance/target)
- ADR Low: 24,500 (potential support/target)
- Monitor how price interacts with these levels throughout the day

**Scenario 2: Session-Based Trading**
Using the statistics table, you notice London on Wednesdays averages 35 points. During a Wednesday London session:
- If London has already moved 30 points, the session may be exhausting its typical range
- If London has only moved 15 points with an hour remaining, there may be expansion potential
- Adjust stop losses and targets based on typical session behavior

**Scenario 3: Probability-Based Setup**
It's 8:05 AM ET and the indicator shows "London Partially Engulfs Upwards":
- You now know there's an 81.51% historical probability NY will take out London's high
- There's a 53.16% probability NY will reach down to Asia's low
- The NY Cash session has a slight bullish bias (55.52%)
- Consider this alongside your technical analysis for directional bias and level targeting

## Customization Options

### Visual Settings
- **Line Width**: Adjust thickness of ADR levels
- **ADR Color/Style**: Customize appearance of ADR projection lines (solid, dashed, dotted)
- **Median Line**: Toggle visibility and customize appearance separately
- **Session Box Colors**: Customize each session's box color independently
- **Show Session Boxes**: Toggle session box visibility on/off

### Label Settings
- **ADR Labels**: Show/hide labels for ADR High and ADR Low, adjust size
- **Median Label**: Separate control for median line label
- **Session Labels**: Show/hide session name labels, adjust size
- **Label Colors**: Customize text colors for all labels

### Table Settings
- **Session Stats Table**: Position (9 locations available), size (Tiny to Huge), toggle on/off
- **Sample Sizes**: Show/hide the number of historical samples used for each calculation
- **Probabilities Table**: Separate position and size controls, toggle on/off

### Session Times
- Each session's time range can be customized to fit different markets or preferences
- All times are in Eastern Time (America/New_York timezone)

## Technical Notes

### Data Requirements
- The indicator requires sufficient historical data based on your lookback settings
- Minimum recommended: 50+ days of intraday data for reliable statistics
- Works on any timeframe below Daily (1-minute, 5-minute, 15-minute, etc.)

### Calculation Methodology
- **ADR Calculation**: Simple average of absolute daily high-low ranges
- **Session Statistics**: Mean average of ranges for each session filtered by day of week
- **Condition Detection**: Boolean logic comparing session high/low relationships
- All calculations update in real-time as new bars form

### Probability Data Source
The probability statistics displayed in the dynamic table are derived from:
- **Dataset**: 12 years of NQ (Nasdaq E-mini futures) historical data
- **Methodology**: Frequency analysis of outcomes following specific setup conditions
- **Time Period**: Multiple market cycles including various volatility regimes

**Critical Warning**: These probabilities are specific to NQ and reflect that instrument's behavior patterns. Market microstructure, participant behavior, and volatility characteristics differ significantly across instruments. Do not apply these NQ-derived probabilities to other markets (ES, RTY, YM, individual stocks, forex, commodities, etc.).

## Best Practices

1. **Combine with Other Analysis**: Use this indicator as one component of a complete trading methodology, not a standalone system
2. **Respect Risk Management**: Probabilities are not certainties; always use proper position sizing and stop losses
3. **Context Matters**: High-impact news events, holiday trading, and extreme volatility can invalidate typical patterns
4. **Verify Statistics**: Monitor your own results and compare to the displayed probabilities
5. **Adapt Session Times**: If trading instruments with different active hours, adjust session times accordingly
6. **Regular Calibration**: Periodically review if the session averages and probabilities remain relevant to current market conditions

## Understanding Originality

This indicator is original in its approach to combining three analytical frameworks into a single tool:

1. **Dynamic ADR Projection**: Unlike static pivot points, these levels adapt daily based on recent volatility
2. **Session-Specific Statistics**: Goes beyond simple volume profiles by quantifying average ranges for specific time windows across weekdays
3. **Conditional Probability Display**: Automatically detects overnight session relationships and displays relevant probability data rather than showing all scenarios simultaneously

The conditional logic system that determines which probability set to display is a key differentiator—traders only see the statistics relevant to the current market setup, reducing information overload and improving decision-making clarity.

## Summary

The **Statistical Daily Profile & Ranges** indicator provides traders with a comprehensive framework for understanding daily range potential, session-specific behavior patterns, and probability-based setup analysis. By combining ADR projection levels with detailed session statistics and dynamic probability displays, traders gain multiple perspectives on potential price movement within the trading day.

The indicator is most effective when used to:
- Set realistic profit targets based on average daily range
- Identify which sessions typically produce movement on specific weekdays
- Understand probability-weighted outcomes for different overnight setup conditions (NQ only)
- Visualize session ranges and compare them to historical averages

Remember that all statistical analysis reflects historical patterns, and market behavior can change. Always combine indicator signals with sound risk management, proper position sizing, and your own market analysis.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.