PROTECTED SOURCE SCRIPT
Trend Line Proximity Meter (Improved v2 with Recent Touches)

Overview
Trend Line Proximity Meter (Improved v2 with Recent Touches) is a powerful overlay tool that transforms any manually-defined trend line (via two configurable points) into a live analytical instrument. It draws the line, auto-detects whether it currently acts as support or resistance, and calculates real-time metrics: % deviation, absolute distance, projected price, slope, historical touch count, and — new in v2 — recent touch count within a user-defined lookback. All data appears in a clean, color-coded dashboard that updates instantly as price moves. Perfect for traders who draw their own channels or trend lines and want objective, quantitative feedback without clutter.
Core Mechanics
Trend Line Creation: Define two points by "bars back" and price type (High/Low/Close/Open/Custom). The script builds the line from those coordinates and optionally extends it as a ray.
Dynamic Role Detection: Automatically classifies the line as Support (price above), Resistance (price below), or Neutral. Auto-colors the line and dashboard accordingly when enabled.
Proximity Engine:
% Deviation: ((close – line price) / line price) × 100
Absolute Distance: close – line price
Projected Price: Exact line value at current bar
Slope: Price change per bar
Touch Counting (v2 Enhancement):
Historical Touches: Total times any candle’s range intersected the line within its drawn/extended segment.
Recent Touches: Same logic but limited to the last N bars (default 50) — instantly shows if the level is “hot” right now.
Tolerance % (default 0.2%) accounts for wicks and minor breaches.
Dashboard: Fully configurable position/size. Displays all metrics with intuitive color coding:
Green/Yellow/Red proximity zones (user-defined thresholds)
Support (green) / Resistance (red) auto-highlighting
Recent vs Historical touch split for quick context
Why This Adds Value & Originality
Most trend line tools only draw lines. This is the only public script that turns a single user-drawn trend line into a full analytical dashboard with real-time deviation %, projected price, slope, and dual touch counters (historical + recent). The recent-touch feature instantly reveals whether a level is currently respected or ignored — information no other indicator provides automatically. Clean, efficient code (no lookahead, no repainting) and smart proximity coloring make it uniquely practical for discretionary traders who rely on hand-drawn lines but want objective data.
How to Use
Draw Your Line:
Set Point 1 (e.g., 100 bars back → Low)
Set Point 2 (e.g., 50 bars back → High)
Adjust style, width, and whether to extend.
Interpret the Dashboard:
Line Type: “SUPPORT” (green) or “RESISTANCE” (red)
Proximity %: +0.4% = price 0.4% above line (green zone = very close)
Recent Touches (Last 50): 4 → level is active now
Historical Touches: 12 → proven significance
Trade Ideas:
Price near line + high recent touches → watch for bounce/rejection
Break with low recent touches → potential trend change
Use alerts for “Price Near Trend Line” or crossovers
Best Practice: Use on 1H–Daily charts; combine with volume or order flow for confluence.
Limitations & Disclaimer
Line is based on two fixed historical points — moving markets may require occasional re-adjustment. Touch detection uses a small tolerance zone (adjustable). No automatic multi-line support (one line per instance). Not financial advice — use with proper risk management. Past performance ≠ future results. Questions? Comment below!
Trend Line Proximity Meter (Improved v2 with Recent Touches) is a powerful overlay tool that transforms any manually-defined trend line (via two configurable points) into a live analytical instrument. It draws the line, auto-detects whether it currently acts as support or resistance, and calculates real-time metrics: % deviation, absolute distance, projected price, slope, historical touch count, and — new in v2 — recent touch count within a user-defined lookback. All data appears in a clean, color-coded dashboard that updates instantly as price moves. Perfect for traders who draw their own channels or trend lines and want objective, quantitative feedback without clutter.
Core Mechanics
Trend Line Creation: Define two points by "bars back" and price type (High/Low/Close/Open/Custom). The script builds the line from those coordinates and optionally extends it as a ray.
Dynamic Role Detection: Automatically classifies the line as Support (price above), Resistance (price below), or Neutral. Auto-colors the line and dashboard accordingly when enabled.
Proximity Engine:
% Deviation: ((close – line price) / line price) × 100
Absolute Distance: close – line price
Projected Price: Exact line value at current bar
Slope: Price change per bar
Touch Counting (v2 Enhancement):
Historical Touches: Total times any candle’s range intersected the line within its drawn/extended segment.
Recent Touches: Same logic but limited to the last N bars (default 50) — instantly shows if the level is “hot” right now.
Tolerance % (default 0.2%) accounts for wicks and minor breaches.
Dashboard: Fully configurable position/size. Displays all metrics with intuitive color coding:
Green/Yellow/Red proximity zones (user-defined thresholds)
Support (green) / Resistance (red) auto-highlighting
Recent vs Historical touch split for quick context
Why This Adds Value & Originality
Most trend line tools only draw lines. This is the only public script that turns a single user-drawn trend line into a full analytical dashboard with real-time deviation %, projected price, slope, and dual touch counters (historical + recent). The recent-touch feature instantly reveals whether a level is currently respected or ignored — information no other indicator provides automatically. Clean, efficient code (no lookahead, no repainting) and smart proximity coloring make it uniquely practical for discretionary traders who rely on hand-drawn lines but want objective data.
How to Use
Draw Your Line:
Set Point 1 (e.g., 100 bars back → Low)
Set Point 2 (e.g., 50 bars back → High)
Adjust style, width, and whether to extend.
Interpret the Dashboard:
Line Type: “SUPPORT” (green) or “RESISTANCE” (red)
Proximity %: +0.4% = price 0.4% above line (green zone = very close)
Recent Touches (Last 50): 4 → level is active now
Historical Touches: 12 → proven significance
Trade Ideas:
Price near line + high recent touches → watch for bounce/rejection
Break with low recent touches → potential trend change
Use alerts for “Price Near Trend Line” or crossovers
Best Practice: Use on 1H–Daily charts; combine with volume or order flow for confluence.
Limitations & Disclaimer
Line is based on two fixed historical points — moving markets may require occasional re-adjustment. Touch detection uses a small tolerance zone (adjustable). No automatic multi-line support (one line per instance). Not financial advice — use with proper risk management. Past performance ≠ future results. Questions? Comment below!
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน