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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.