Chartbreaker
    Preparing search index...

    PopGun Generator

    The PopGun generator identifies and visualizes "PopGun" candlestick patterns on the chart. A PopGun pattern occurs when a candle is fully enclosed (encapsulated) between its two neighboring candles, followed by a breakout candle that confirms the direction.

    Use a Controller object to add the generator to a chart:

    const popGunGenerator = controller.addGenerator('PopGuns');
    

    A PopGun pattern is identified when:

    1. A candle's high and low are both within the high/low range of its left and right neighbors (the "encapsulated" candle).
    2. The generator waits 8 candles after the encapsulated candle.
    3. If the open of the 7th candle after the encapsulated candle breaks above the right neighbor's high, it's a top breakout (bullish signal).
    4. If the open of the 7th candle after the encapsulated candle breaks below the right neighbor's low, it's a bottom breakout (bearish signal).
    5. If neither trigger is hit after 8 candles, the pattern is discarded.

    Additional filters:

    • Patterns with gaps larger than 1.5x the chart resolution between the three candles are ignored (weekends, holidays).
    • For intraday charts, only candles between 8:00 and 22:00 are considered.
    • Type: LineWidth

    • Default: 2

    • Details

      The line width of the trigger lines in pixels.

    • Type: boolean

    • Default: false

    • Details

      When enabled, the top trigger line extends to the right edge of the chart.

    • Type: boolean

    • Default: false

    • Details

      When enabled, the bottom trigger line extends to the right edge of the chart.

    • Type: enum

    • Default: 0 (No limit)

    • Values: 0 (No limit) | 1 (5 days) | 2 (1 month) | 3 (12 months) | 4 (36 months) | 5 (60 months)

    • Details

      Limits how far back in time PopGun patterns are detected. When set to "No limit", all available data is scanned.

    Each confirmed PopGun pattern is drawn as:

    • A highlighted rectangle covering the three candles of the encapsulated pattern.
    • Two horizontal trigger lines extending from the right neighbor candle's high and low.
      • Top line color: 'up-color'
      • Bottom line color: 'down-color'
    • A highlighted rectangle on the trigger candle (7 candles after the encapsulated candle).
    • A second highlighted rectangle on the first subsequent candle that reaches the trigger line (when the trigger is hit).

    The trigger lines can be individually toggled per pattern via context menu actions:

    • Extend top trigger: Toggle right-extension of the top line.
    • Extend bottom trigger: Toggle right-extension of the bottom line.

    The generator includes a legend entry. When a time limit is set, the legend displays the selected period.

    Permissions

    The generator has a built-in permission check, which is called in its onStart method. It calls the provided checkPermission method (via Controller) with the key PopGuns.