OPEN-SOURCE SCRIPT
已更新 Candle % High/Low Bar + HL Order + MA by Barty&PitPapcio

What does the indicator show?
The "Candle % High/Low Bar + HL Order + MA by Barty&PitPapcio" indicator displays the percentage deviation of each candle’s high and low relative to its open price. The zero line represents the candle’s open — bars above zero show upward movement from the open (to high), bars below zero show downward movement (to low).
Additionally, the indicator plots a dot above or below each bar indicating which came first during the candle — the high or the low — based on data from a lower timeframe two steps below the current chart (for example, on a 1-hour chart it uses 15-minute data).
Finally, the indicator calculates and plots a user-selectable moving average (EMA, SMA, or WMA) of these "first high or low" signals, helping identify trends whether the first move is more often upwards or downwards.
Where do the data come from?
Percentage values are calculated directly from the current chart’s candles:
The timing of the first high or low for each candle is retrieved from a lower timeframe, stepping down two levels from the current timeframe (e.g. from 1H to 15 min), providing better precision in detecting the order of highs and lows that may be blurred on higher timeframes.
Additional features:
Suggested strategy for technical analysis support
Lots of love, Bartosz
The "Candle % High/Low Bar + HL Order + MA by Barty&PitPapcio" indicator displays the percentage deviation of each candle’s high and low relative to its open price. The zero line represents the candle’s open — bars above zero show upward movement from the open (to high), bars below zero show downward movement (to low).
Additionally, the indicator plots a dot above or below each bar indicating which came first during the candle — the high or the low — based on data from a lower timeframe two steps below the current chart (for example, on a 1-hour chart it uses 15-minute data).
Finally, the indicator calculates and plots a user-selectable moving average (EMA, SMA, or WMA) of these "first high or low" signals, helping identify trends whether the first move is more often upwards or downwards.
Where do the data come from?
Percentage values are calculated directly from the current chart’s candles:
- highPerc=(High−Open)/Open×100%,
- lowPerc=(Low−Open)/Open×100%
The timing of the first high or low for each candle is retrieved from a lower timeframe, stepping down two levels from the current timeframe (e.g. from 1H to 15 min), providing better precision in detecting the order of highs and lows that may be blurred on higher timeframes.
Additional features:
- Full customization of colors for bars, dots, zero line, grid, and thicknesses.
- Background grid with adjustable scale and style.
- Safety checks for missing lower timeframe data.
- A moving average smoothing the sequence of first high/low signals to reveal directional tendencies.
Suggested strategy for technical analysis support
- Identify dominant candle direction: If the dot often appears above the bar (first high), it indicates buying pressure; if below (first low), selling pressure dominates.
- Use percentage deviations: Large percent bars indicate heightened volatility and potential reversal points.
- Moving average on order signals: The EMA of high/low first signals smooths the noise, showing the dominant trend in the sequence of price moves, useful for filtering other signals.
- Combine with other tools: This indicator can act as a directional filter on multiple timeframes, synergizing well with momentum indicators, RSI, or support/resistance levels to confirm move strength.
Lots of love, Bartosz
版本注释
What was changed in the script:Modified: Moving Average (MA) Calculation
- Previous version:
The moving average was calculated using the values 1 or -1, depending on whether the High or Low came first on a lower timeframe.
1 for High first
-1 for Low first
These values formed the hlSeries array used in the moving average calculation. - New version (current):
The moving average is now calculated using the actual percentage movement:- If High was first → use % to High (highPerc)
- If Low was first → use % to Low (lowPerc)
- These values are stored in the new hlPerc series.
- If High was first → use % to High (highPerc)
This change makes the moving average curve more meaningful and visible, since it's now based on the actual magnitude of candle movement rather than a flat binary -1/1 pattern.
Why the change matters:
- The previous method made the MA line too flat and not reflective of real volatility or strength.
- Now the MA responds to the size of price movement — not just the direction.
- It helps you detect trends in how strong the first movement tends to be (up or down) across candles.
What does the indicator show?
The "Candle % High/Low Bar + HL Order + MA by Barty&PitPapcio" indicator displays the percentage deviation of each candle’s high and low relative to its open price. The zero line represents the candle’s open — bars above zero show upward movement from the open (to high), bars below zero show downward movement (to low).
Additionally, the indicator plots a dot above or below each bar indicating which came first during the candle — the high or the low — based on data from a lower timeframe one step below the current chart (for example, on a 1-hour chart it uses 30-minute data).
Finally, the indicator calculates and plots a user-selectable moving average (EMA, SMA, or WMA) of these "first high or low" signals, helping identify trends whether the first move is more often upwards or downwards.
Where do the data come from?
Percentage values are calculated directly from the current chart’s candles:
- highPerc=(High−Open)/Open×100%,
- lowPerc=(Low−Open)/Open×100%
The timing of the first high or low for each candle is retrieved from a lower timeframe, stepping down two levels from the current timeframe (e.g. from 1H to 15 min), providing better precision in detecting the order of highs and lows that may be blurred on higher timeframes.
Additional features:
- Full customization of colors for bars, dots, zero line, grid, and thicknesses.
- Background grid with adjustable scale and style.
- Safety checks for missing lower timeframe data.
- A moving average smoothing the sequence of first high/low signals to reveal directional tendencies.
- Suggested strategy for technical analysis support
- Identify dominant candle direction: If the dot often appears above the bar (first high), it indicates buying pressure; if below (first low), selling pressure dominates.
- Use percentage deviations: Large percent bars indicate heightened volatility and potential reversal points.
- Moving average on order signals: The EMA of high/low first signals smooths the noise, showing the dominant trend in the sequence of price moves, useful for filtering other signals.
- Combine with other tools: This indicator can act as a directional filter on multiple timeframes, synergizing well with momentum indicators, RSI, or support/resistance levels to confirm move strength.
Lots of love, Bartosz
版本注释
I only changed the image, the code remained unchanged.开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。