Skip to content
DiscordTwitter

Custom Advanced Price Patterns

This guide shows you how to create custom price pattern detection strategies using GrailHub’s visual flow builder. You’ll learn to combine multiple components to detect patterns like Double Bottom, Rectangle, and other advanced formations.

Price patterns are visual formations on charts that traders use to predict future price movements. GrailHub provides building blocks that let you create custom pattern detection without coding.

ComponentPurpose
Extreme DC DetectorFinds local highs and lows in price data
Extreme ClassifierSeparates extremes into tops and bottoms
Extreme RangeSelects a specific number of extreme points
Horizontal BandCreates support/resistance zones from extreme points
Breakout ConfirmationDetects when price breaks through a band
SynchronizerWaits for multiple inputs before proceeding

Before diving into the flow setup, let’s understand the terminology used in price pattern detection.

An extreme is a significant turning point in price - either a local high (peak) or local low (valley). Think of it as the “tip” of a mountain or the “bottom” of a valley on a price chart.

Price
  │     Peak (Extreme High)
  │      /\
  │     /  \      /\
  │    /    \    /  \
  │   /      \  /    \
  │  /        \/      
  │           Valley (Extreme Low)
  └─────────────────────── Time

Not every small wiggle counts as an extreme. The detection algorithm filters out minor fluctuations and only marks points where price made a significant reversal.

The Directional Change algorithm is a method for detecting extremes. Instead of looking at fixed time intervals, it focuses on price movement magnitude.

Here’s how it works:

  1. Start tracking from a reference point
  2. Monitor price movement in one direction
  3. When price reverses by more than a threshold (e.g., 2%), mark an extreme
  4. The previous direction’s endpoint becomes the new extreme

Example with 2% threshold:

  • Price rises from $100 to $110 (+10%)
  • Price then drops to $107.80 (-2% from $110)
  • The $110 point is marked as an extreme high

This approach adapts to market volatility - in calm markets, it finds smaller swings; in volatile markets, only major reversals qualify.

Support is a price level where buying pressure tends to prevent further decline. Think of it as a “floor” that price bounces off.

Resistance is a price level where selling pressure tends to prevent further rise. Think of it as a “ceiling” that price struggles to break through.

Price
  │ ─────────────── Resistance (ceiling)
  │    /\    /\
  │   /  \  /  \
  │  /    \/    \
  │ ─────────────── Support (floor)
  └─────────────────────── Time

A band is a price zone rather than a single price level. Since prices rarely hit exact numbers, we create a range around a level.

For example, a support band at $100 with 2% tolerance creates a zone from $98 to $102. Price must break clearly below $98 to confirm a breakdown.

A breakout occurs when price moves decisively through a support or resistance band. It signals a potential trend change or continuation.

  • Resistance breakout (upward): Bullish signal, price breaks above the ceiling
  • Support breakout (downward): Bearish signal, price breaks below the floor

A Double Bottom is a bullish reversal pattern with two roughly equal lows followed by a breakout above resistance.

flowchart TB
    A[Ticker Stream] --> B[Aggregate Bars]
    B --> C[Series Converter]
    C --> D[Extreme DC Detector]
    D --> E[Extreme Classifier]
    E --> F[Extreme Range - Tops]
    E --> G[Extreme Range - Bottoms]
    F --> H[Horizontal Band - Resistance]
    G --> I[Horizontal Band - Support]
    H --> J[Synchronizer]
    I --> J
    J --> K[Breakout Confirmation]
    K --> L[Notification]

1. Data Source: Ticker Stream → Aggregate Bars

Section titled “1. Data Source: Ticker Stream → Aggregate Bars”

Start with a Ticker Stream - this is your flow’s entry point. Every time the price changes, it triggers the entire pattern detection pipeline.

  • Set Symbol to your trading pair (e.g., BTC-USDT)

Connect it to Aggregate Bars to convert raw price ticks into candlestick data. Pattern detection needs historical structure, not just the current price.

  • Set Timeframe to your preferred interval (e.g., 1 Day)
  • Set Bar Count to 10-20 bars for sufficient pattern history

Data flow: Each price update fetches fresh candlestick history.


Candlesticks contain multiple fields (open, high, low, close, volume), but our detection algorithm works with simple number sequences. The Series Converter extracts just one field.

  • Set Field to Close for standard detection
  • Use Low for conservative bottom detection, High for conservative top detection

Data flow: Transforms candlesticks into a number list like [100, 102, 98, 105, 103].


This is where the magic happens. The DC algorithm scans your price series and identifies significant turning points - the peaks and valleys that form chart patterns.

  • Set Extreme Tolerance to 0.02 (2%) for typical patterns
  • Lower values detect more swings, higher values filter out noise

Data flow: Outputs a series of turning points from your price data.


The detector finds ALL turning points mixed together. The Classifier separates them into two groups: peaks (potential resistance) and valleys (potential support).

  • Top Series output: Local highs
  • Bottom Series output: Local lows

Data flow: Sorts turning points into “peaks” and “valleys” buckets.


We only care about recent extremes. A Double Bottom needs the last 2 bottoms and recent tops for the resistance level.

For Tops (Resistance):

  • Connect to Top Series
  • Position: Last, Count: 2

For Bottoms (Support):

  • Connect to Bottom Series
  • Position: Last, Count: 2

Data flow: Filters to keep only the most recent N extreme points.


Single price points aren’t practical for breakout detection. Bands create zones around those points - a $100 level with 2% tolerance becomes a $98-$102 zone.

Resistance Band:

  • Connect to Tops Extreme Range
  • Tolerance: 0.02, Timeframe: match your data

Support Band:

  • Connect to Bottoms Extreme Range
  • Tolerance: 0.02, Timeframe: match your data

Data flow: Converts price points into tradeable zones.


The two bands calculate in parallel. Before checking for breakouts, we need BOTH bands ready. The Synchronizer waits for all inputs before proceeding.

  • Connect Data 1 to Resistance Band
  • Connect Data 2 to Support Band

Data flow: Ensures both zones are calculated before the breakout check.


The final decision maker. It compares current price against the band and signals when price breaks through. For Double Bottom, we watch for upward breakout through resistance.

  • Connect Band to Resistance Band (via Synchronizer)
  • Connect Series to your price series
  • Set Level to Resistance

Data flow: Outputs true when price breaks the zone, false otherwise.


Convert the boolean signal into an actionable alert. When breakout confirms, you get notified immediately.

  • Configure bot token and chat ID
  • Message template: 🚀 Double Bottom Breakout Detected!

Data flow: Transforms true signal into a human-readable message.

A Rectangle pattern forms when price bounces between horizontal support and resistance levels.

The Rectangle pattern uses a similar structure but focuses on detecting breakouts from either direction:

flowchart TB
    A[Ticker Stream] --> B[Aggregate Bars]
    B --> C[Series Converter]
    C --> D[Extreme DC Detector]
    D --> E[Extreme Classifier]
    E --> F[Extreme Range - Tops]
    E --> G[Extreme Range - Bottoms]
    F --> H[Horizontal Band - Resistance]
    G --> I[Horizontal Band - Support]
    H --> J[Synchronizer]
    I --> J
    J --> K[Breakout - Resistance]
    J --> M[Breakout - Support]
    K --> L[Notification - Bullish]
    M --> N[Notification - Bearish]
  1. Two Breakout Components: One for resistance breakout (bullish), one for support breakout (bearish)
  2. Separate Notifications: Different alerts for upward vs downward breakouts
  3. Band Configuration: Both bands are equally important

For Resistance Breakout:

  • Set Level to Resistance
  • Alert message: 📈 Rectangle Breakout UP!

For Support Breakout:

  • Set Level to Support
  • Alert message: 📉 Rectangle Breakout DOWN!
SettingDescriptionRecommended
Extreme TolerancePercentage threshold for detecting extremes0.01 - 0.05
  • Lower values (0.01): More sensitive, detects smaller swings
  • Higher values (0.05): Less sensitive, only major swings
SettingDescriptionOptions
PositionWhich extremes to selectFirst or Last
CountNumber of extremes to include1-10
  • Use Last for recent patterns
  • Use First for historical patterns
SettingDescriptionRecommended
ToleranceBand width as percentage0.01 - 0.03
TimeframeTime unit for the bandMatch your data timeframe
SettingDescriptionOptions
LevelWhich level to check for breakoutResistance or Support
  • More signals: Lower tolerance values, more extreme points
  • Fewer signals: Higher tolerance values, fewer extreme points
  • Shorter timeframes (1m, 5m): More patterns, more noise
  • Longer timeframes (1h, 1d): Fewer patterns, more reliable

You can enhance pattern detection by adding:

  • RSI: Confirm oversold/overbought conditions
  • Volume: Validate breakouts with volume confirmation
  • Moving Averages: Filter patterns based on trend direction

GrailHub includes ready-to-use templates for common patterns:

  • Double Bottom: Bullish reversal pattern detection
  • Rectangle: Range-bound breakout detection

To use a template:

  1. Create a new flow
  2. Select a template from the template gallery
  3. Customize settings for your trading pair and preferences