GridRunner
Overview
Adaptive grid trading strategy that dynamically adjusts to market conditions. Places a grid of buy orders below and sell orders above a calculated center price, profiting from price oscillations within the grid range. Detects the current market regime (ranging, trending up/down, or high volatility) and adapts grid spacing, center bias, and position sizing accordingly. Grid spacing is ATR-based and automatically adjusts to current volatility. Includes margin ratio gating, max filled level limits, trailing stops on accumulated positions, and emergency close for when price breaks the grid boundary.
Requirements
Required Indicators
| Supported Markets | Spot & Futures |
Configuration Parameters
Grid Settings
Configure grid structure, spacing, and direction
| Parameter | Type | Default | Description |
|---|---|---|---|
TRADE_DIRECTIONTrade Direction | Select: long | short | both | both | Grid direction: long = buy low/sell high, short = sell high/buy low, both = bidirectional |
GRID_LEVELSGrid Levels | Number | 4 | Number of grid levels per side |
SPACING_MODESpacing Mode | Select: atr | percentage | fixed | percentage | How grid spacing is calculated |
SPACING_ATR_MULTSpacing ATR Multiplier | Number | 1 | ATR multiplier for spacing (when mode=atr) |
SPACING_PERCENTSpacing Percent | Number | 1 | Percentage between levels (when mode=percentage) |
SPACING_FIXEDSpacing Fixed | Number | 100 | Fixed dollar spacing (when mode=fixed) |
GRID_RECENTER_THRESHOLDRecenter Threshold | Number | 3 | Recenter grid when price moves beyond N levels |
Risk Management
Configure margin, position sizing, and emergency limits
| Parameter | Type | Default | Description |
|---|---|---|---|
MAX_POSITION_MARGIN_PCTMax Margin (%) | Number | 40 | Max margin usage percentage before pausing entries |
MAX_FILLED_LEVELSMax Filled Levels | Number | 4 | Max simultaneous filled levels on one side |
SIZE_PER_LEVEL_PCTSize Per Level (%) | Number | 3 | Balance percentage allocated per grid level |
EMERGENCY_CLOSE_ATR_MULTEmergency Close ATR Mult | Number | 8 | Emergency close when price moves N x ATR from center |
MIN_SPIN_BETWEEN_ORDERSMin Spins Between Orders | Number | 1 | Minimum spins between consecutive orders |
Strategy Logic
Configure trend detection and grid bias behavior
| Parameter | Type | Default | Description |
|---|---|---|---|
TREND_ADX_THRESHOLDTrend ADX Threshold | Number | 25 | ADX above this = trending market |
ENABLE_TREND_BIASEnable Trend Bias | Boolean | Disabled | Shift grid center with detected trend direction (opt-in) |
ENABLE_TRAIL_STOPEnable Trailing Stop | Boolean | Disabled | Enable trailing stop on accumulated position (opt-in) |
TRAIL_ACTIVATION_PCTTrail Activation (%) | Number | 5 | Trailing stop activation percentage |
TRAIL_PERCENTTrail Percent | Number | 2 | Trailing stop distance percentage |
TP/SL Configuration
Configure take profit and stop loss distance modes
| Parameter | Type | Default | Description |
|---|---|---|---|
TAKE_PROFIT_MULTTake Profit Multiplier | Number | 0.7 | Take profit as fraction of grid spacing |
TP_SL_MODETP/SL Mode | Select: spacing | percentage | atr | spacing | TP/SL distance mode: spacing = fraction of grid spacing, percentage = fixed %, atr = ATR-based |
TP_PERCENTTP Percent | Number | 1 | TP distance as percentage of fill price (when mode=percentage) |
SL_PERCENTSL Percent | Number | 2 | SL distance as percentage of fill price (when mode=percentage) |
TP_ATR_MULTTP ATR Multiplier | Number | 1 | TP distance as ATR multiple (when mode=atr) |
SL_ATR_MULTSL ATR Multiplier | Number | 2 | SL distance as ATR multiple (when mode=atr) |
Version Info
Current Version: v1.0
Latest Changes
Initial release
Changelog
| Version | Date | Type | Changes |
|---|---|---|---|
| v1 | 2025-02-18 | Initial release |