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).
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。