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 8th candle breaks above the encapsulated range's high, it's a top breakout (bullish signal).
    4. If the open of the 8th candle breaks below the encapsulated range's low, it's a bottom breakout (bearish signal).
    5. If neither trigger is hit after 8 candles, the pattern is discarded.

    Additional filters:

    • 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 encapsulated candle's high and low.
      • Top line color: 'up-color'
      • Bottom line color: 'down-color'
    • A highlighted rectangle on the first candle after the pattern (7 candles later).
    • A second highlighted rectangle on the breakout candle (when the trigger is hit).

    The trigger lines and candle highlights 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.