OPEN-SOURCE SCRIPT
H4 High Low Lines

OVERVIEW
This indicator marks the high and low of the last N completed 4-hour candles on any chart timeframe (1m, 5m, 15m, 4H, etc.), syncing automatically to the symbol's real 4-hour session boundaries.
HOW TO USE
Add the indicator to any chart. Two lines are drawn for each completed 4H candle: one at the wick high, one at the wick low. Each line starts exactly at the bar where that high or low occurred, extends a configurable distance ahead of price, and is labeled "H4" to the right.
Use the "Max H4 Candles to Show" input to choose how many recent 4H candles to display (1 to 10, default 2). Line color, width, style, label text, label color, label size, extend length, and label gap are all configurable in the inputs.
LIMITATIONS
The script relies on a non-repainting multi-timeframe request to the native 240 ("240" minute / 4H) series. Because of this, on a realtime bar the script waits for the underlying 4H bar to be confirmed before drawing it, which introduces a small delay relative to the moment the 4H candle actually closes. This is expected behavior for non-repainting higher-timeframe requests and is not a bug.
NOTES
This script uses the request.security() offset-and-lookahead technique documented by PineCoders in their "Higher-timeframe requests" publication to avoid repainting and ensure consistent timing across historical and live bars.
This indicator marks the high and low of the last N completed 4-hour candles on any chart timeframe (1m, 5m, 15m, 4H, etc.), syncing automatically to the symbol's real 4-hour session boundaries.
HOW TO USE
Add the indicator to any chart. Two lines are drawn for each completed 4H candle: one at the wick high, one at the wick low. Each line starts exactly at the bar where that high or low occurred, extends a configurable distance ahead of price, and is labeled "H4" to the right.
Use the "Max H4 Candles to Show" input to choose how many recent 4H candles to display (1 to 10, default 2). Line color, width, style, label text, label color, label size, extend length, and label gap are all configurable in the inputs.
LIMITATIONS
The script relies on a non-repainting multi-timeframe request to the native 240 ("240" minute / 4H) series. Because of this, on a realtime bar the script waits for the underlying 4H bar to be confirmed before drawing it, which introduces a small delay relative to the moment the 4H candle actually closes. This is expected behavior for non-repainting higher-timeframe requests and is not a bug.
NOTES
This script uses the request.security() offset-and-lookahead technique documented by PineCoders in their "Higher-timeframe requests" publication to avoid repainting and ensure consistent timing across historical and live bars.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。