OPEN-SOURCE SCRIPT
Mis à jour

MTF Price Range Boxes

354
snapshot

MTF Price Range Boxes v4
Multi‑Timeframe Price Range Boxes + Fibonacci Levels

Purpose
Displays higher timeframe price range rectangles (High↔Low / Open↔Close) on the current chart, plus optional 0.382, 0.5, 0.618 Fibonacci lines.

Parameters
  • Price range mode – HL (High/Low only) or OHLC (body + wick)
  • Up body color – Bullish body color (default orange, transp. 80)
  • Up wick color – Bullish wick color in OHLC mode (default orange, transp. 90)
  • Down body color – Bearish body color (default gray, transp. 80)
  • Down wick color – Bearish wick color in OHLC mode (default gray, transp. 90)
  • Show Fibonacci lines – Toggle 0.382/0.5/0.618 solid lines on/off
  • Target timeframe – 1 hour, 4 hours, Day, Week (must be higher than current timeframe)


Notes
Rectangles and lines are drawn once when the target timeframe closes – no repainting. If target ≤ current timeframe, an error message appears in the top‑right corner.
Notes de version
修复:矩形右边界减去一个当前K线周期(barMs),确保覆盖正确数量的K线。
Notes de version
修复:高周期结束判断改用 time_close >= htfTimeClose 并配合变化检测,解决跳空行情下矩形不显示的问题。
Notes de version
新增四条独立进场/出场位线系统

1号进场位(默认50%,灰色点线)

2号进场位(默认62%,灰色点线)

3号进场位(默认72%,灰色点线)

4号出场位(默认-28%,蓝色实线)

智能方向计算

上涨K线:进场位从最高点向下计算;出场位(负百分比)从最高点向上延伸。

下跌K线:进场位从最低点向上计算;出场位(负百分比)从最低点向下延伸。

每条线独立可配置

开关(显示/隐藏)

百分比位置(可正可负)

颜色、线宽、线型(实线/虚线/点线)
Notes de version
移除所有用户设置面板:所有 input 参数均添加 display=display.none,用户无法修改任何数值,指标完全按代码内默认值运行。

自动周期规则重新制定:从原先的“大一级”逻辑改为“至少4倍”逻辑,并扩展支持更多标准周期(2小时、12小时、6个月等)。

手动周期选项保留但不可见:autoTarget 仍为 true,实际上从未使用手动模式,但代码结构保留

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.