Donchian Flag Pole Setup

Donchian Flag Pole Setup

Description

The Donchian Flag Pole Setup indicator builds on the output of the Flag Pole Detector and identifies structured trade setups in the form of pullbacks or breakouts following a flag pole impulse. After detecting a qualifying pole, the indicator defines a pullback zone and monitors for entry signals based on trader-defined logic.

Setup entries can be classified into:

Pullback entries: Price retraces to a specified level within the pole.

Breakout entries: Price breaks out from the flag structure after consolidation.

This tool is highly customizable and includes filters based on pullback size, duration, and Donchian Channel-relative range. An optional ImpulseExtremeBreak setting forces confirmation by requiring price to break the extreme bar that marked the flag’s impulse, enhancing entry selectivity.

Key Features:

  • Detects setups that follow valid Donchian flag pole formations.
  • Supports three entry types:
    • Pullback
    • Formation breakout
    • Breakout on bar close
  • Filters trades using:
    • Minimum and maximum pullback depth
    • Minimum and maximum pullback duration
    • Impulse extreme break condition
  • Validates flag pole size based on relative Donchian Channel percentage.
  • Integrates seamlessly with the Donchian Flag Pole Detector.
  • Plots visual levels and signal markers for strategy building and discretionary trading.
  • Works on all markets and timeframes.

Tips for Implementation:

  • Entry Type Selection: Choose Pullback for retracements, FormationBreakout for breakout-style trades, or BreakoutClose for conservative confirmation after the breakout bar closes.
  • Pullback Management: Use MinPullbackBars and MaxPullbackBars to limit setups to your timing preference. This helps avoid overly long or short flags.
  • Impulse Validation: Enable ImpulseExtremeBreak if you want extra confirmation that the impulse had strength before entering a trade.
  • Volatility Adaptation: Adjust the ATR-based parameters on the detector to better fit volatile or low-volatility environments.
  • Donchian Context: The ComparisonDCPeriod and range percentage settings help scale the setup quality across different market conditions.

Parameters

001 Detector Parameters

Donchian Channel Period:

  • Type: int
  • Description: Number of periods used to calculate the Donchian Channel.
  • Default Value: 5
  • Valid Range: Any positive integer greater than or equal to 1.

Load Period:

  • Type: int
  • Description: Number of bars considered for the load phase.
  • Default Value: 2
  • Valid Range: Any positive integer greater than or equal to 1.

Load Extreme Break

  • Type: bool
  • Description: Inherited from the Flag Pole Detector. If enabled, ensures the pole must break the extreme of the Donchian channel set during the load phase.
  • Default: false

Body Average Period:

  • Type: int
  • Description: Number of bars used to calculate the average body size.
  • Default Value: 3
  • Valid Range: Any positive integer greater than or equal to 1.

Pole Min Bars:

  • Type: int
  • Description: Minimum number of bars required in the flag pole.
  • Default Value: 1
  • Valid Range: Any positive integer greater than or equal to 1.

Pole Max Bars:

  • Type: int
  • Description: Maximum number of bars allowed in the flag pole.
  • Default Value: 4
  • Valid Range: Any positive integer greater than or equal to 1.

002 Setup Parameters

Setup Type:

  • Type: Enum (Pullback, Formation Breakout, Breakout Close)
  • Description: The type of setup the indicator will focus on (pullback or breakout logic).
  • Default Value: Formation Breakout

Min Pullback Bars:

  • Type: int
  • Description: Minimum number of bars for a valid pullback.
  • Default Value: 1

Max Pullback Bars:

  • Type: int
  • Description: Maximum number of bars allowed in the pullback.
  • Default Value: 5

Comparison DC Period:

  • Type: int
  • Description: Period of the comparison Donchian Channel.
  • Default Value: 100

Pole DC Range Min Percentage:

  • Type: int
  • Description: Minimum percentage of the flag pole relative to the comparison Donchian Channel range.
  • Default Value: 10

Pole DC Range Max Percentage:

  • Type: int
  • Description: Maximum percentage of the flag pole relative to the comparison Donchian Channel range.
  • Default Value: 50

Min Pullback Percentage:

  • Type: int
  • Description: Minimum percentage pullback level relative to the flag pole.
  • Default Value: 30

Max Pullback Percentage:

  • Type: int
  • Description: Maximum percentage pullback level relative to the flag pole.
  • Default Value: 100

Impulse Extreme Break:

  • Type: bool
  • Description: When enabled, the bar that made a new high or low during the impulse must be broken during the pullback for the setup to be considered valid.
  • Default Value: false
  • Options: true (Enabled), false (Disabled)

Plot Offset (Ticks):

  • Type: int
  • Description: Distance between plotted signals and the high or low point of the bar, measured in ticks.
  • Default Value: 5

Plots

IndicatorSignalUp:

  • Type: Plot
  • Style: Green Triangle Up
  • Description: Marks a confirmed bullish setup, either as a pullback or breakout.

IndicatorSignalDown:

  • Type: Plot
  • Style: Red Triangle Down
  • Description: Marks a confirmed bearish setup, either as a pullback or breakout.

SignalUpUpperLevel:

  • Type: Plot
  • Style: Green Hash Line
  • Description: Denotes the upper level of the bullish setup's flag pole.

SignalUpLowerLevel:

  • Type: Plot
  • Style: Green Hash Line
  • Description: Denotes the lower level of the bullish setup's flag pole.

SignalDownUpperLevel:

  • Type: Plot
  • Style: Red Hash Line
  • Description: Denotes the upper level of the bearish setup's flag pole.

SignalDownLowerLevel:

  • Type: Plot
  • Style: Red Hash Line
  • Description: Denotes the lower level of the bearish setup's flag pole.