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.
Overview
Section titled “Overview”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.
Key Components
Section titled “Key Components”| Component | Purpose |
|---|---|
| Extreme DC Detector | Finds local highs and lows in price data |
| Extreme Classifier | Separates extremes into tops and bottoms |
| Extreme Range | Selects a specific number of extreme points |
| Horizontal Band | Creates support/resistance zones from extreme points |
| Breakout Confirmation | Detects when price breaks through a band |
| Synchronizer | Waits for multiple inputs before proceeding |
Understanding Key Terms
Section titled “Understanding Key Terms”Before diving into the flow setup, let’s understand the terminology used in price pattern detection.
What is an “Extreme”?
Section titled “What is an “Extreme”?”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)
└─────────────────────── TimeNot 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 (DC) Algorithm
Section titled “The Directional Change (DC) Algorithm”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:
- Start tracking from a reference point
- Monitor price movement in one direction
- When price reverses by more than a threshold (e.g., 2%), mark an extreme
- 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 and Resistance
Section titled “Support and Resistance”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)
└─────────────────────── TimeWhat is a “Band”?
Section titled “What is a “Band”?”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.
Breakout
Section titled “Breakout”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
Building a Double Bottom Pattern
Section titled “Building a Double Bottom Pattern”A Double Bottom is a bullish reversal pattern with two roughly equal lows followed by a breakout above resistance.
Flow Structure
Section titled “Flow Structure”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]
Step-by-Step Setup
Section titled “Step-by-Step Setup”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.
2. Series Converter
Section titled “2. Series Converter”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
Closefor standard detection - Use
Lowfor conservative bottom detection,Highfor conservative top detection
Data flow: Transforms candlesticks into a number list like
[100, 102, 98, 105, 103].
3. Extreme DC Detector
Section titled “3. Extreme DC Detector”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.
4. Extreme Classifier
Section titled “4. Extreme Classifier”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.
5. Extreme Range (x2)
Section titled “5. Extreme Range (x2)”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.
6. Horizontal Band (x2)
Section titled “6. Horizontal Band (x2)”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.
7. Synchronizer
Section titled “7. Synchronizer”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.
8. Breakout Confirmation
Section titled “8. Breakout Confirmation”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
truewhen price breaks the zone,falseotherwise.
9. Telegram Notification
Section titled “9. Telegram Notification”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
truesignal into a human-readable message.
Building a Rectangle Pattern
Section titled “Building a Rectangle Pattern”A Rectangle pattern forms when price bounces between horizontal support and resistance levels.
Flow Structure
Section titled “Flow Structure”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]
Key Differences from Double Bottom
Section titled “Key Differences from Double Bottom”- Two Breakout Components: One for resistance breakout (bullish), one for support breakout (bearish)
- Separate Notifications: Different alerts for upward vs downward breakouts
- Band Configuration: Both bands are equally important
Configuration Tips
Section titled “Configuration Tips”For Resistance Breakout:
- Set Level to
Resistance - Alert message:
📈 Rectangle Breakout UP!
For Support Breakout:
- Set Level to
Support - Alert message:
📉 Rectangle Breakout DOWN!
Component Settings Guide
Section titled “Component Settings Guide”Extreme DC Detector
Section titled “Extreme DC Detector”| Setting | Description | Recommended |
|---|---|---|
| Extreme Tolerance | Percentage threshold for detecting extremes | 0.01 - 0.05 |
- Lower values (0.01): More sensitive, detects smaller swings
- Higher values (0.05): Less sensitive, only major swings
Extreme Range
Section titled “Extreme Range”| Setting | Description | Options |
|---|---|---|
| Position | Which extremes to select | First or Last |
| Count | Number of extremes to include | 1-10 |
- Use
Lastfor recent patterns - Use
Firstfor historical patterns
Horizontal Band
Section titled “Horizontal Band”| Setting | Description | Recommended |
|---|---|---|
| Tolerance | Band width as percentage | 0.01 - 0.03 |
| Timeframe | Time unit for the band | Match your data timeframe |
Breakout Confirmation
Section titled “Breakout Confirmation”| Setting | Description | Options |
|---|---|---|
| Level | Which level to check for breakout | Resistance or Support |
Tips for Custom Patterns
Section titled “Tips for Custom Patterns”Adjusting Sensitivity
Section titled “Adjusting Sensitivity”- More signals: Lower tolerance values, more extreme points
- Fewer signals: Higher tolerance values, fewer extreme points
Timeframe Selection
Section titled “Timeframe Selection”- Shorter timeframes (1m, 5m): More patterns, more noise
- Longer timeframes (1h, 1d): Fewer patterns, more reliable
Combining with Other Indicators
Section titled “Combining with Other Indicators”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
Pre-built Templates
Section titled “Pre-built Templates”GrailHub includes ready-to-use templates for common patterns:
- Double Bottom: Bullish reversal pattern detection
- Rectangle: Range-bound breakout detection
To use a template:
- Create a new flow
- Select a template from the template gallery
- Customize settings for your trading pair and preferences