# Final Flag

Final Flag is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Finds Al Brooks' final flag: a tight, horizontal flag late in a trend of at least 5 ATR with earlier pushes, closing through the trend's trendline, whose breakout to a new extreme fails back into the flag within five bars. The reversal is traded with a stop beyond the breakout extreme toward the start of the final leg, and failed failures that resume the trend are flagged.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jan 15, 2026.
- Access: free.
- Concepts: [final flag](https://www.luxalgo.com/library/concept/final-flag/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=kc6dkfejzz4xkiv2i3gr5quh
- Page: https://www.luxalgo.com/library/indicator/final-flag/

The **Final Flag** is an advanced technical analysis tool designed to identify potential trend exhaustion by isolating specific, late-stage market consolidation patterns. By monitoring for a protracted trend followed by a tight, horizontal flag, the indicator looks for a "blow-off" style breakout to a new extreme that subsequently fails. This reversal signal helps traders identify high-probability turning points in markets that have reached the end of their current momentum, offering a structured way to play counter-trend moves with defined risk parameters.

## How to Trade the Final Flag?

To trade using the Final Flag, you should wait for the indicator to identify a confirmed "Final Flag" signal, which occurs when a breakout to a new trend extreme is quickly rejected. Once the signal appears, the tool automatically plots the entry, stop-loss, and target levels based on the geometry of the flag and the failed breakout. 

The entry typically triggers when price confirms the failure, either by closing back within the flag or through the flag, depending on your configuration. The protective stop is placed just beyond the breakout's extreme, effectively using the "failed" high or low as the point of invalidation. The target is usually set either at the opposite side of the flag or back at the start of the final price leg. Because this is a reversal strategy, it is most effective when combined with broader market context, such as identifying if the trend has traveled significantly in terms of ATR and has experienced multiple preceding pushes to new highs or lows.

## Final Flag Settings

### Late Trend
* **Trend Lookback**: Determines the number of bars to scan for the trend's origin.
* **Minimum Trend Travel (ATR)**: Sets the required distance the price must have moved in ATR units to be considered a mature, extended trend.
* **Minimum Prior Pushes**: Specifies the number of price pushes to a new extreme required before the flag can be considered "late."

### Flag
* **Flag Length**: Defines the minimum and maximum number of bars the consolidation must span.
* **Maximum Flag Height (ATR)**: Limits the vertical range of the flag, ensuring the consolidation remains tight.
* **Maximum Drift (% of Height)**: Constrains how much the flag may tilt or slope; lower values ensure a more horizontal, compressed range.
* **Require Trendline Break**: When active, the flag must breach the established trendline to confirm the exhaustion of the move.

### Breakout & Failure
* **Failure**: Selects between "Back Inside the Flag" or "Through the Flag" to determine when the failure is confirmed.
* **Maximum Breakout Extension (ATR)**: Defines the limit for how far the price can move beyond the flag during the breakout before the setup is invalidated.
* **Failure Window (Bars)**: The maximum number of bars allowed for the breakout to fail; if it takes longer, the signal is ignored.

### Trade Plan
* **Target**: Sets the exit objective to either the beginning of the last leg or the far side of the flag.
* **Stop Buffer (ATR)**: Adds a padding distance to the stop-loss beyond the breakout extreme.
* **Failed Failure Window (Bars)**: The time frame for identifying a "failed failure," which serves as a signal that the original trend is actually resuming.
* **Maximum Hold (Bars)**: The limit on how long a trade will stay open before being timed out.

## Frequently Asked Questions

### What differentiates a standard flag from a final flag?
A standard flag is usually a consolidation within a developing trend, whereas a final flag is specifically tuned to identify exhaustion at the very end of a trend. It requires significant prior travel and multiple pushes to ensure the market is likely overextended before signaling a reversal.

### How does the indicator handle a breakout that succeeds?
If the breakout remains outside the flag for longer than the specified failure window, the indicator marks the setup as a "Breakout held." This indicates that the market is likely continuing its primary trend rather than reversing, allowing the user to avoid fading a strong move.

### Can this tool be used for trend continuation?
While the tool is built to signal reversals, the "Failed Failure" logic allows you to identify when an attempted reversal itself has failed. In such cases, the resumption of the primary trend can sometimes offer an opportunity to trade with the original momentum.

## Related indicators

- [N Bar Reversal Detector](https://www.luxalgo.com/library/indicator/n-bar-reversal-detector/) (Key Reversal): markdown at https://www.luxalgo.com/library/indicator/n-bar-reversal-detector.md
- [Bart Pattern](https://www.luxalgo.com/library/indicator/bart-pattern/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/bart-pattern.md
- [Head & Shoulders](https://www.luxalgo.com/library/indicator/head-and-shoulders/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/head-and-shoulders.md
- [Wolfe Wave Detector](https://www.luxalgo.com/library/indicator/wolfe-wave-detector/) (Wolfe Waves): markdown at https://www.luxalgo.com/library/indicator/wolfe-wave-detector.md
- [Island Reversal](https://www.luxalgo.com/library/indicator/island-reversal/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/island-reversal.md
- [McDonald's Pattern](https://www.luxalgo.com/library/indicator/mcdonalds-pattern/) (Double Top/bottom): markdown at https://www.luxalgo.com/library/indicator/mcdonalds-pattern.md
- [Diamond Top/bottom](https://www.luxalgo.com/library/indicator/diamond-top-bottom/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/diamond-top-bottom.md
- [Horns Pattern Identifier](https://www.luxalgo.com/library/indicator/horns-pattern-identifier/) (Rare Reversal Patterns): markdown at https://www.luxalgo.com/library/indicator/horns-pattern-identifier.md

---

Source: https://www.luxalgo.com/library/indicator/final-flag/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
