Higher High Lower Low Strategy (With Source Code)
Jul 9, 2019

The Higher High Lower Low Strategy indicator identifies market structure by detecting pivot points and labeling them as Higher Highs (HH), Higher Lows (HL), Lower Highs (LH), and Lower Lows (LL) to assist in trend identification and dynamic support/resistance mapping.
Usage
The indicator is used to visualize price action trends and potential reversal points. By identifying the sequence of pivot points, users can determine the prevailing market direction:
- Uptrend: Characterized by a sequence of Higher Highs and Higher Lows.
- Downtrend: Characterized by a sequence of Lower Lows and Lower Highs.
The script also features dynamic support and resistance levels derived from these structural points. When the price breaks above a resistance level, the trend is considered bullish, and the bars are colored accordingly. Conversely, when the price breaks below a support level, the trend is considered bearish.
Details
The script utilizes a pivot-based algorithm to find local peaks and troughs based on the "Left Bars" and "Right Bars" settings. It then compares the current pivot to historical pivots to classify the structure (HH, HL, LH, or LL).
A core component of the script is its dynamic support and resistance logic. Resistance is established or updated at Lower Highs or Higher Highs depending on the current trend state, while support is established at Higher Lows or Lower Lows. The trend state remains bullish as long as the price stays above the dynamic support and turns bearish when the price closes below it.
Settings
- Left Bars: Determines the number of bars to the left required to confirm a pivot point.
- Right Bars: Determines the number of bars to the right required to confirm a pivot point; higher values increase lag but provide more significant structural points.
- Support/Resistance: Toggles the visibility of the dynamic horizontal support and resistance lines.
- Support Color: Sets the color for the dynamic support lines.
- Resistance Color: Sets the color for the dynamic resistance lines.
- Line Style/Width: Adjusts the visual appearance (solid, dashed, dotted) and thickness of the S/R lines.
- Change Bar Color: When enabled, colors the price bars based on the current trend (Bullish/Bearish).
- Bullish/Bearish Color: Sets the specific colors for the trend-based bar coloring.
FAQ
How can I adjust the sensitivity of the pivot detection? You can decrease the "Left Bars" and "Right Bars" settings to make the indicator more sensitive to smaller price fluctuations, or increase them to focus on major structural shifts.
What does the bar coloring represent? The bar coloring represents the current trend bias. Green (or your chosen bullish color) indicates the price is trading above the dynamic support level, while Red (or your bearish color) indicates the price has broken below support and is in a downtrend.
How do I access the Higher High Lower Low Strategy? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.