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!
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations โ learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations โ learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.