OPEN-SOURCE SCRIPT
Descriptive Statistics [Median, Quartiles, Outliers]

This indicator seeks to provide insight to traders by modeling market structure using widely accepted statistical methods applied to price data. It does not predict direction; instead, it describes how current price behaves relative to its historical distribution.
It is built around non-parametric statistics, making it resistant to distortion from extreme price movements.
What it shows?
1. Median (Q2): The central equilibrium level of price distribution.
2. Quartiles (Q1, Q3): Boundaries of the “normal” trading range.
3. Interquartile Range (IQR): Measures the width of the core market structure.
4. Outlier Bands (1.5 × IQR rule): Statistical extremes where price becomes unusual relative to recent behavior.
How it works?
The indicator collects price data either through:
1. Reset Mode: Builds a new distribution each session (Daily, Weekly, Monthly, or chart timeframe).
2. Length Mode: Uses a rolling window of the last N candles.
All values are sorted to construct a real-time price distribution, from which median, quartiles, and outlier thresholds are derived.
How to use it?
1. Price inside Q1–Q3 range → normal market conditions
2. Price near Median → equilibrium / fair value zone
3. Price outside Outlier bands → statistically extreme conditions (potential exhaustion, expansion zones or news driven events)
4. Large expansions between Q1 and Q3 → increased volatility and potential momentum in either direction
Key concept?
This tool does not forecast price. It provides a distribution map of market behavior, helping traders understand structure, deviation, and statistical positioning of price.
⚠️ Note
This indicator is for educational and analytical purposes only and should not be used as standalone trading advice.
Author: TUGUME WILLIAM MUTARA
It is built around non-parametric statistics, making it resistant to distortion from extreme price movements.
What it shows?
1. Median (Q2): The central equilibrium level of price distribution.
2. Quartiles (Q1, Q3): Boundaries of the “normal” trading range.
3. Interquartile Range (IQR): Measures the width of the core market structure.
4. Outlier Bands (1.5 × IQR rule): Statistical extremes where price becomes unusual relative to recent behavior.
How it works?
The indicator collects price data either through:
1. Reset Mode: Builds a new distribution each session (Daily, Weekly, Monthly, or chart timeframe).
2. Length Mode: Uses a rolling window of the last N candles.
All values are sorted to construct a real-time price distribution, from which median, quartiles, and outlier thresholds are derived.
How to use it?
1. Price inside Q1–Q3 range → normal market conditions
2. Price near Median → equilibrium / fair value zone
3. Price outside Outlier bands → statistically extreme conditions (potential exhaustion, expansion zones or news driven events)
4. Large expansions between Q1 and Q3 → increased volatility and potential momentum in either direction
Key concept?
This tool does not forecast price. It provides a distribution map of market behavior, helping traders understand structure, deviation, and statistical positioning of price.
⚠️ Note
This indicator is for educational and analytical purposes only and should not be used as standalone trading advice.
Author: TUGUME WILLIAM MUTARA
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.