OPEN-SOURCE SCRIPT
Avg Leg Duration (Single Value + Unit)

Avg Leg Duration (Bars + Time)
Avg Leg Duration is a market rhythm and trend behavior indicator designed to measure how long directional price movements typically persist before changing direction.
Instead of focusing only on price magnitude, this indicator analyzes the duration of completed directional "legs" and calculates the average length of recent movements. The objective is to provide insight into the natural pacing and behavior of the current market environment.
Understanding how long trends and directional moves typically last can help traders better evaluate trend maturity, timing expectations, and overall market behavior.
Features:
• Measures completed directional price legs
• Calculates average duration across recent legs
• Customizable averaging period
• Optional ATR-based movement threshold filtering
• Optional directional carry-through for flat bars
• Multiple output units:
• Bars
• Seconds
• Minutes
• Hours
• Days
• Weeks
• Multiple rounding methods:
• None
• Round
• Ceiling
• Floor
• Simple on-chart display showing current average leg duration
Potential use cases:
• Estimate how long directional moves typically last
• Identify potentially extended or immature trends
• Compare market rhythm across different instruments
• Study changing market conditions
• Add timing context to existing strategies
• Evaluate whether price movements are becoming more compressed or extended
Interpretation:
Lower Average Duration
Directional moves are changing more frequently and may indicate increased choppiness or shorter-term market behavior.
Higher Average Duration
Directional moves are persisting longer and may indicate stronger directional behavior or longer trend cycles.
Changing Average Duration
Expanding or contracting values can suggest shifts in market participation and behavior.
Unlike traditional momentum indicators that focus primarily on price movement itself, Avg Leg Duration focuses on the time component of market behavior and attempts to provide additional context into how markets naturally move and cycle.
About TrendGenY Indicators
TrendGenY indicators are built from market experience, creative concepts, and a constant pursuit of unique perspectives. Rather than following conventional ideas, the focus is on uncovering alternative insights and viewing market behavior through different angles to reveal information that traditional tools may overlook and help traders build a more meaningful edge in the market.
Avg Leg Duration is a market rhythm and trend behavior indicator designed to measure how long directional price movements typically persist before changing direction.
Instead of focusing only on price magnitude, this indicator analyzes the duration of completed directional "legs" and calculates the average length of recent movements. The objective is to provide insight into the natural pacing and behavior of the current market environment.
Understanding how long trends and directional moves typically last can help traders better evaluate trend maturity, timing expectations, and overall market behavior.
Features:
• Measures completed directional price legs
• Calculates average duration across recent legs
• Customizable averaging period
• Optional ATR-based movement threshold filtering
• Optional directional carry-through for flat bars
• Multiple output units:
• Bars
• Seconds
• Minutes
• Hours
• Days
• Weeks
• Multiple rounding methods:
• None
• Round
• Ceiling
• Floor
• Simple on-chart display showing current average leg duration
Potential use cases:
• Estimate how long directional moves typically last
• Identify potentially extended or immature trends
• Compare market rhythm across different instruments
• Study changing market conditions
• Add timing context to existing strategies
• Evaluate whether price movements are becoming more compressed or extended
Interpretation:
Lower Average Duration
Directional moves are changing more frequently and may indicate increased choppiness or shorter-term market behavior.
Higher Average Duration
Directional moves are persisting longer and may indicate stronger directional behavior or longer trend cycles.
Changing Average Duration
Expanding or contracting values can suggest shifts in market participation and behavior.
Unlike traditional momentum indicators that focus primarily on price movement itself, Avg Leg Duration focuses on the time component of market behavior and attempts to provide additional context into how markets naturally move and cycle.
About TrendGenY Indicators
TrendGenY indicators are built from market experience, creative concepts, and a constant pursuit of unique perspectives. Rather than following conventional ideas, the focus is on uncovering alternative insights and viewing market behavior through different angles to reveal information that traditional tools may overlook and help traders build a more meaningful edge in the market.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。