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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.