Consecutive Candles Trigger
The consecutive_candles trigger fires when a specified number of candles in a row are all the same color (red/bearish or green/bullish). It detects short-term momentum patterns — a streak of red candles often precedes a bounce, while a streak of green candles confirms a breakout.
TOML Syntax
[[actions.triggers]]
type = "consecutive_candles"
value = "3_red" # Required: {count}_{direction}
timeframe = "5m" # Required: candle size for counting
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | — | Must be "consecutive_candles" |
value | string | Yes | — | Pattern: "{count}_{direction}" |
timeframe | string | Yes | — | Candle size for consecutive counting |
max_count | integer | No | unlimited | Maximum times this trigger can fire per position |
The value Format
The value follows the pattern {count}_{direction}:
| Value | Meaning |
|---|---|
"3_red" | 3 consecutive bearish (close < open) candles |
"3_green" | 3 consecutive bullish (close >= open) candles |
"5_red" | 5 consecutive bearish candles |
"5_green" | 5 consecutive bullish candles |
- Red/bearish: candle close < candle open
- Green/bullish: candle close >= candle open
How It Works
The engine groups 1-minute candles into the specified timeframe, then checks if the last N grouped candles are all the same color.
For example, with timeframe = "5m" and value = "3_red":
- Group every 5 consecutive 1-minute candles into one 5-minute candle
- Check the last 3 of these 5-minute candles
- If all 3 have close < open (red), the trigger fires
graph TD
A["Group 1m candles<br/>into timeframe candles"] --> B["Check last N<br/>grouped candles"]
B --> C{"All same<br/>color?"}
C -->|Yes| D["Trigger fires"]
C -->|No| E["No action"]
Valid Timeframes
The timeframe field accepts: 1m, 5m, 15m, 1h, 4h, 1d.
The timeframe determines the candle size used for consecutive counting. "3_red" on "5m" means three consecutive 5-minute red candles (15 minutes of selling). "3_red" on "1h" means three consecutive hourly red candles (3 hours of selling).
Examples
Buy After 3 Consecutive Red 5m Candles
A classic dip-buying pattern — three red candles in a row often precede a bounce:
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
type = "consecutive_candles"
value = "3_red"
timeframe = "5m"
Combine with ROC for Sharp Dip Detection
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
indicator = "roc_10"
operator = "<"
target = "-3"
timeframe = "5m"
[[actions.triggers]]
type = "consecutive_candles"
value = "3_red"
timeframe = "5m"
Breakout Confirmation with Green Candles
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
type = "consecutive_candles"
value = "5_green"
timeframe = "1h"
[[actions.triggers]]
indicator = "sma_50"
operator = ">"
target = "sma_200"
timeframe = "1d"
Tips
Three consecutive red candles on 5-minute or 15-minute timeframes is a common dip-buying signal. It indicates short-term selling pressure that may be about to exhaust.
On higher timeframes (1h, 4h), even 3 consecutive red candles represents a significant trend. Make sure your strategy can handle the drawdown if the streak continues.
Pair consecutive_candles with an RSI or StochRSI confirmation for higher-quality entries. Three red candles alone do not guarantee a bounce — oversold confirmation makes the signal stronger.
Related Triggers
| Trigger | What It Measures |
|---|---|
| Price Change | Global % price movement over time |
| Next Candle | Candle-close scheduling and delay |