BandGrid

Spot & FuturesMean Reversionv1.0

Overview

Mean-reversion grid strategy that anchors buy and sell levels to Bollinger Bands. The grid automatically widens during volatile periods and tightens during calm periods as Bollinger Bands expand and contract with realized volatility. Buy orders are placed in the lower half of the band range (statistically oversold) and sell orders in the upper half (overbought), with take-profit targets aiming for mean reversion to the SMA middle line. A three-tier regime detection system (Active, Cautious, Paused) protects against trending markets using ADX and band width analysis. Entry quality is enhanced with optional RSI confirmation filtering.

Requirements

Required Indicators

RSIADXBollinger BandsATR
Supported MarketsSpot & Futures

Configuration Parameters

Grid Settings

Configure grid structure and Bollinger Band parameters

ParameterTypeDefaultDescription
TRADE_DIRECTIONTrade DirectionSelect: long | short | bothlongGrid direction: long/short/both
SPACING_MODESpacing ModeSelect: bb | atr | percentage | fixedpercentageSpacing source: percentage (default), bb derives from band width
BB_PERIODBB PeriodNumber20Bollinger Band period
BB_STDDEVBB Std DevNumber2Bollinger Band standard deviation multiplier
GRID_LEVELSGrid LevelsNumber3Grid levels per side within bands
SPACING_ATR_MULTSpacing ATR MultiplierNumber1ATR multiplier (when mode=atr)
SPACING_PERCENTSpacing PercentNumber1.5Percentage spacing (when mode=percentage)
SPACING_FIXEDSpacing FixedNumber100Fixed dollar spacing (when mode=fixed)

Risk Management

Configure margin limits and position sizing

ParameterTypeDefaultDescription
SIZE_PER_LEVEL_PCTSize Per Level (%)Number5Balance percentage per grid level
MAX_FILLED_LEVELSMax Filled LevelsNumber6Max simultaneous filled levels
MAX_POSITION_MARGIN_PCTMax Margin (%)Number35Max margin usage percentage
EMERGENCY_SIGMAEmergency SigmaNumber3Emergency close at N sigma deviation

Strategy Logic

Configure regime detection and RSI filtering

ParameterTypeDefaultDescription
RSI_OVERSOLDRSI OversoldNumber50RSI threshold for buy entry — buys placed when RSI below this
RSI_OVERBOUGHTRSI OverboughtNumber50RSI threshold for sell entry — sells placed when RSI above this
ENABLE_RSI_FILTEREnable RSI FilterBooleanDisabledFilter limit orders by RSI momentum direction (opt-in)
REGIME_ADX_MAXRegime ADX MaxNumber22ADX ceiling for active grid operation
TRAIL_PERCENTTrail PercentNumber1Trailing stop for paused regime positions

TP/SL Configuration

Configure take profit and stop loss distance modes

ParameterTypeDefaultDescription
TAKE_PROFIT_MULTTake Profit MultiplierNumber1Take profit as fraction of grid spacing (1.0 = TP at one full spacing from fill)
LEVEL_SL_MULTLevel SL MultiplierNumber2Per-level stop loss as multiple of grid spacing (0 = disabled)
TP_SL_MODETP/SL ModeSelect: spacing | percentage | atrspacingTP/SL distance mode: spacing = fraction of grid spacing, percentage = fixed %, atr = ATR-based
TP_PERCENTTP PercentNumber1.5TP distance as percentage of fill price (when mode=percentage)
SL_PERCENTSL PercentNumber3SL distance as percentage of fill price (when mode=percentage)
TP_ATR_MULTTP ATR MultiplierNumber1TP distance as ATR multiple (when mode=atr)
SL_ATR_MULTSL ATR MultiplierNumber2SL distance as ATR multiple (when mode=atr)

Version Info

Current Version: v1.0

Latest Changes

Initial release

Changelog

VersionDateTypeChanges
v12025-02-18Initial release