InfinityGrid

Spot & FuturesMean Reversionv1.0

Overview

Geometric (percentage-based) grid trading strategy designed for long-term operation on assets with bullish bias. Unlike arithmetic grids that use fixed dollar spacing, InfinityGrid uses percentage spacing so each completed grid cycle captures the same percentage return regardless of current price level. The grid has a configurable lower bound (capital protection floor) but no upper bound, continuing to generate sell orders at higher price levels indefinitely. Grid recycling creates an infinite buy-sell cycle: when a buy fills, a sell is placed one level up, and vice versa. Each completed cycle captures GRID_PERCENT% profit minus fees. State management uses a sliding window of active levels around current price, preventing state bloat while maintaining the infinite grid illusion. Optional profit compounding reinvests a portion of grid profits into larger level sizes.

Requirements

Required Indicators

ADXATR
Supported MarketsSpot & Futures

Configuration Parameters

Grid Settings

Configure geometric grid structure and bounds

ParameterTypeDefaultDescription
TRADE_DIRECTIONTrade DirectionSelect: long | short | bothlongDirection: long = accumulate on dips, short = distribute on rallies, both = bidirectional grid
GRID_PERCENTGrid PercentNumber1.5Percentage spacing between geometric grid levels
LOWER_BOUND_PCTLower Bound (%)Number50Lower bound as percentage below initial price
MAX_ACTIVE_LEVELSMax Active LevelsNumber40Max levels tracked in state (sliding window)
MAX_OPEN_BUYSMax Open BuysNumber10Max unfilled buy orders below price

Risk Management

Configure position sizing and capital allocation

ParameterTypeDefaultDescription
INVESTMENT_PER_GRIDInvestment Per GridNumber0Fixed quote currency per level (0 = auto from SIZE_PER_LEVEL_PCT)
SIZE_PER_LEVEL_PCTSize Per Level (%)Number3Balance percentage per level when INVESTMENT_PER_GRID is 0
LEVEL_SL_MULTLevel SL MultiplierNumber3Per-level stop loss as multiple of grid spacing (0 = disabled)

Strategy Logic

Configure trend guard and compounding behavior

ParameterTypeDefaultDescription
PAUSE_ON_TREND_DOWNPause On Trend DownBooleanEnabledPause new buys when ADX > 25 and trend is bearish
ENABLE_COMPOUNDEnable CompoundingBooleanDisabledReinvest grid profits into larger level sizes
COMPOUND_RATECompound Rate (%)Number50Percentage of grid profit to reinvest

TP/SL Configuration

Configure take profit and stop loss distance modes

ParameterTypeDefaultDescription
TP_SL_MODETP/SL ModeSelect: spacing | percentage | atrspacingTP/SL distance mode: spacing = grid percent based, percentage = fixed %, atr = ATR-based
TP_PERCENTTP PercentNumber1.5TP distance as percentage of fill price (when mode=percentage)
SL_PERCENTSL PercentNumber4.5SL 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 MultiplierNumber3SL distance as ATR multiple (when mode=atr)

Version Info

Current Version: v1.0

Latest Changes

Initial release

Changelog

VersionDateTypeChanges
v12025-02-18Initial release