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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。