OPEN-SOURCE SCRIPT
[Top] 🦙 LHAMA Consolidation Detector

The [Top] 🦙 LHAMA Consolidation Detector is a multi-line Adaptive Moving Average tool designed to detect market consolidation and trending behavior with greater precision than traditional moving averages.
LHAMA (pronounced Llama 🦙) stands for Low-High Adaptive Moving Average. Unlike conventional MAs such as EMA or SMA, which apply fixed smoothing, LHAMA dynamically adapts to price action using recent high/low range behavior and optional volume weighting. This makes it more responsive during trending conditions and more stable during consolidation—helping traders avoid false signals and better anticipate breakout opportunities.
This indicator plots up to six independent LHAMA lines, each with fully customizable settings:
• Length: control how sensitive each line is to recent price action
• Timeframe: run each LHAMA on any custom resolution
• Volume Weighting: optionally adjust responsiveness using volume data
• Bull/Bear/Flat Colors: color-code each line's trend direction and slope strength
• Line Width: choose how prominently each line is drawn
Each line uses slope-weighted gradient coloring, transitioning between user-defined bullish, bearish, and flat colors based on the steepness and direction of the trend. Consolidation shows clearly as the user defined Flat color, while sharper trends fade fully into Bull or Bear colors, making consolidation zones and breakouts visually intuitive.
By offering adaptive behavior and per-line configurability, LHAMA gives traders powerful multi-timeframe insight for scalping, swing trading, and broader trend analysis.
LHAMA (pronounced Llama 🦙) stands for Low-High Adaptive Moving Average. Unlike conventional MAs such as EMA or SMA, which apply fixed smoothing, LHAMA dynamically adapts to price action using recent high/low range behavior and optional volume weighting. This makes it more responsive during trending conditions and more stable during consolidation—helping traders avoid false signals and better anticipate breakout opportunities.
This indicator plots up to six independent LHAMA lines, each with fully customizable settings:
• Length: control how sensitive each line is to recent price action
• Timeframe: run each LHAMA on any custom resolution
• Volume Weighting: optionally adjust responsiveness using volume data
• Bull/Bear/Flat Colors: color-code each line's trend direction and slope strength
• Line Width: choose how prominently each line is drawn
Each line uses slope-weighted gradient coloring, transitioning between user-defined bullish, bearish, and flat colors based on the steepness and direction of the trend. Consolidation shows clearly as the user defined Flat color, while sharper trends fade fully into Bull or Bear colors, making consolidation zones and breakouts visually intuitive.
By offering adaptive behavior and per-line configurability, LHAMA gives traders powerful multi-timeframe insight for scalping, swing trading, and broader trend analysis.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.