Order-Flow Market Structure
Jul 22, 2025

The Order-Flow Market Structure indicator provides a comprehensive visualization of price structure shifts and swing points using higher timeframe data. It aims to automate the identification of internal market shifts, swing highs/lows, and break of structure (BOS) events to assist traders in maintaining structural context.
Usage
The indicator can be used to identify key institutional price action levels and structural transitions. Traders typically select a higher timeframe (HTF) relative to their trading chart (e.g., using a 1-hour HTF on a 5-minute chart) to establish the primary trend direction.
- Internal Shifts: Identified by higher timeframe candle closes, these signal early changes in trend momentum.
- Swing Points: The script plots labels for Higher Highs (HH), Higher Lows (HL), Lower Highs (LH), and Lower Lows (LL) to track the trend's progression.
- Break of Structure (BOS): Confirmed when price closes beyond a previous swing point, triggering horizontal line plots.
- Fibonacci Retracements: Automatic levels are drawn between the most recent swing high and low to highlight potential retracement zones.
Details
The script functions by requesting data from a user-defined timeframe and comparing current closes against previous high/low values to determine structural shifts. It utilizes a "Safe History Offset" to manage processing lookbacks, ensuring the indicator remains performant even on assets with significant historical data. The visual output includes a zigzag line connecting structural points to provide a clear view of the order flow.
Settings
General
- HTF Timeframe: Sets the higher timeframe used for calculating structure and internal shifts.
- Use Safe History Offset Limit?: Toggles the limit on how far back the script scans for structural points.
- Max Safe History Offset: Defines the maximum bar lookback to prevent buffer errors.
Visuals
- Width of Lines: Adjusts the thickness of the zigzag and BOS lines.
- ZigZag Line Color/Style: Customizes the appearance of the lines connecting swing points.
- BOS Colors/Style: Individual color settings for bullish and bearish Break of Structure lines.
Fibonacci
- Show Downtrend/Uptrend Fibonacci Lines: Toggles the visibility of retracement levels.
- Fibonacci Colors: Customizable color inputs for each standard Fibonacci ratio (0.0 to 1.0).
Alerts
- Alert Mode: Choose between LTF, MTF, or HTF alert sensitivities.
- Swing Highs & Lows: Enables alerts for newly formed swing points.
- BoS: Enables alerts for Break of Structure events.
FAQ
How do I interpret the internal shifts? Bullish internal shifts suggest a transition from selling to buying pressure, while bearish shifts suggest the opposite. These are often used as early entries or signals to tighten stop losses.
What does the "Safe History Offset" do? It limits the calculation depth to ensure the script doesn't exceed TradingView's resource limits, which is particularly useful for volatile assets or long-term charts.
How can I access Order-Flow Market Structure? 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.