OPEN-SOURCE SCRIPT
Median Point of Control

Median Point of Control calculates and displays the median OHLC4 price for customizable time periods, along with percentage-based upper and lower bands. It provides a statistical reference framework for identifying potential support, resistance, and mean-reversion zones.
What It Does
This indicator computes the median of all OHLC4 values within a defined period and plots three horizontal levels:
The current period's levels update dynamically as new bars form. Completed periods are preserved as historical reference lines.
Why Median Instead of Average?
The median is the "middle" value when all prices are sorted. Unlike the mean (average), the median is resistant to outliers — a single extreme wick or price spike won't distort the level. This makes it more representative of typical price action during the period.
Two Calculation Modes
Settings
How To Use
Important Notes
What It Does
This indicator computes the median of all OHLC4 values within a defined period and plots three horizontal levels:
- Median Line — The statistical middle price of the period
- Upper Band — Median + user-defined percentage
- Lower Band — Median - user-defined percentage
The current period's levels update dynamically as new bars form. Completed periods are preserved as historical reference lines.
Why Median Instead of Average?
The median is the "middle" value when all prices are sorted. Unlike the mean (average), the median is resistant to outliers — a single extreme wick or price spike won't distort the level. This makes it more representative of typical price action during the period.
Two Calculation Modes
- Timeframe Mode Define periods using standard timeframes: 4H, Daily, Weekly, Monthly, etc. The indicator automatically detects when each period begins and ends.
- Bars Mode Define periods by a fixed number of bars (e.g., every 50 bars, every 100 bars). Useful for non-time-based analysis or custom period lengths that don't align with standard timeframes.
Settings
- Calculation Mode: Choose between Timeframe or Bars
- Timeframe: Period length when using Timeframe mode
- Bars: Number of bars per period when using Bars mode
- Band Distance (%): Percentage offset for upper/lower bands from median
- Line Colors: Customize colors for median, upper, and lower bands
- Line Width: Thickness of the plotted lines
- Historical Transparency: Opacity of completed period lines
- Max Historical Periods: Number of past periods to display
How To Use
- Identify the range: The upper and lower bands create a price envelope based on the period's median. When price approaches these levels, watch for reactions.
- Mean reversion reference: The median line represents the "fair value" of the period. Price tends to oscillate around this level.
- Breakout detection: If price breaks and holds beyond a band, it may signal trend continuation rather than reversion.
- Multi-timeframe analysis: Use Daily median on intraday charts to see where price stands relative to the day's statistical center.
Important Notes
- This indicator does not predict price direction. It provides statistical reference levels only.
- The current period's median updates with each new bar — this is expected behavior, not repainting.
- Historical period lines are fixed once their period closes.
- For best results, use on liquid instruments (stocks, forex majors, major crypto pairs).
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.