تم تحديثه

HH/LL Trendlines [twr]

9 141
Automatically detects swing structure (HH/HL/LH/LL) using pivot highs/lows, labels each swing point, and — the key feature — draws trendlines connecting same-type consecutive pivots: LH→LH on the high side, HL→HL on the low side. This visualizes the two "structure lines" traders watch for trend continuation and potential breaks.
How it works
  • Pivot detection & classification
  • Uses ta.pivothigh()/ta.pivotlow() with a user-defined Swing Length (fractal-style, symmetric lookback/lookforward)
  • Each new swing high is compared to the prior swing high: higher → labeled HH (bullish, green), lower → labeled LH (bearish, red)
  • Each new swing low is compared to the prior swing low: lower → labeled LL (bearish, red), higher → labeled HL (bullish, green)
  • First pivot on each side gets a neutral "x" label since there's nothing to compare against yet

لقطة
Trendline logic
  • Only connects pivots of the same classification — so a LH connects to the previous LH (skipping over any HH in between), and a HL connects to the previous HL. This produces clean descending-resistance / ascending-support structure lines rather than zigzagging between every pivot.
  • Lines are capped per side (Max Trend Lines Shown) using an array-based pool with oldest-first trimming, so the chart doesn't get cluttered over time

Live projection
  • If Project Lines Forward is enabled, each line's slope is recalculated every bar and extended to the current bar (getProjectedY()), so the structure line behaves like a live trend channel boundary rather than a static segment frozen at the two pivot points
  • Optional Remove Line Once Price Crosses It will auto-delete a line when price closes (or wicks, depending on Cross Source) through the projected level — useful for treating the line as an invalidated trendline break

Inputs summary
  • Structure: swing length, label toggle
  • Trend Lines: enable high/low connections independently, line width/style, max lines per side
  • Projection: forward extension toggle, cross-removal toggle, cross source (Close vs High/Low)
  • Colors: bullish/bearish color customization
ملاحظات الأخبار
Added ZigZag with live line

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.