Geometric Grid Machine [3Commas] β€” Strategy by 3Commas

By 3Commas

Performance Metrics

Description

[3Commas] Geometric Grid MachineπŸ”· What it does:This strategy implements a geometric grid trading system on liquid range-bound instruments. It pre-computes a ladder of 56 price levels between a configurable High and Low boundary using geometric spacing (β‰ˆ 0.6% step), then buys at each level when price crosses down through it and sells at the next level up when price crosses back through. Profit comes from capturing the spread between adjacent grid lines on every oscillation. A trailing-up mechanic shifts the entire grid upward when price breaks above the High, allowing the system to follow rising trends without abandoning open positions. - 56 geometrically-spaced levels between Low (29.73) and High (41.31) - Buy on close-cross-down through an unfilled level; sell on close-cross-up through the next level - Fixed notional per level (28.15 USDT default), all fills equally sized - Trailing up activates when price exceeds High by 3%, shifts grid by 50% of range - No stop loss β€” positions held until matching sell level is hitπŸ”· Who is it for: Range-bound market traders who want to extract value from sideways price action. Bot operators who automate grid execution through webhook integration with a connected bot. Volatility harvesters who profit from oscillations rather than directional moves. Spot traders with a ranging view on liquid altcoins, perpetuals, or major pairs.πŸ”· How does it work: Long Entry: When close crosses down through an unfilled grid level, the strategy opens a long position sized to the per-level notional amount. Each level is independent β€” multiple buys can stack across the ladder simultaneously, which is what creates the GRID accumulation effect during a downtrend. Short Entry: Not used β€” this is a long-only spot grid. Exit Management: For each filled level, the strategy places a limit exit at the next level up. When close crosses up through that target, the position closes and the level becomes available to buy again. There is no stop loss β€” invalidation is handled structurally by the grid's Low boundary, which sets the worst-case accumulation point. Trailing Up: If close exceeds the current High by 3%, the entire grid shifts upward by 50% of the range. Levels recalculate to the new High/Low, and the strategy continues operating in the shifted range. Open positions remain; their exit targets now refer to the new level structure.πŸ”· Why it's unique: Geometric distribution β€” most grid implementations use arithmetic (linear) spacing, which produces unequal percentage steps at different price levels. Geometric spacing maintains a constant percentage step across the entire range (β‰ˆ 0.6% in default config), which is structurally fairer when the instrument is far from zero and is the same model used by professional grid bots. Trailing-up architecture β€” fixed grids break when trends carry price out of range. The trailing-up mechanic detects a sustained break above the High and re-centers the grid around current price, preserving open positions and continuing operation without manual intervention. Bot Integration β€” entry and exit alerts ship with webhook-ready JSON payloads. Two alert events (grid_start on first bar in window, grid_shift_up on trailing event) enable an external bot to mirror state changes. Bot ID, Email Token, and pair label are exposed as inputs.πŸ”· Considerations Before Using the Indicator: Market & Timeframe: This strategy is highly timeframe-sensitive and is calibrated for a 15-minute chart. Backtest fill density and overall P&L depend directly on how often close crosses grid levels, which is governed by bar duration. Higher timeframes (1h+) will show far fewer fills and may underperform; lower timeframes (1m, 5m) increase fills but slow down backtests significantly on standard TradingView plans. The runtime warning label on the chart will flag any timeframe other than 15m so the user is aware. Limitations: No stop loss is implemented. If price breaks below the grid's Low boundary, all filled levels accumulate unrealized loss until either the average is recovered through subsequent bounces or the user manually closes the position. The strategy assumes a structurally ranging instrument β€” sustained one-way trends (especially downtrends) will produce maximum drawdown without the trailing-up feature triggering. Pair this strategy with manual range validation before deploying capital. Backtesting & Demo Testing: Always validate the grid range and step size on historical data for the specific instrument you intend to trade. Each instrument has a different volatility profile, and the optimal grid parameters vary accordingly. Re-test on your own venue using venue-specific commission and slippage. Demo-trade for at least one month before any live deployment. Past performance is not indicative of future results. Parameter Adjustments: Commission defaults to 0.1% (Bybit spot taker). Adjust to match your exchange β€” Coinbase Advanced ~0.5%, Binance Spot ~0.1%, OKX Spot ~0.08%. Slippage of 2 ticks is conservative for liquid pairs β€” increase for thin order books. Grid range (High/Low) and level count should be re-tuned per instrument volatility β€” wider ranges and more levels for highly volatile assets, tighter setups for stable ranges.πŸ”· STRATEGY PROPERTIES Symbol: BYBIT:HYPEUSDT.P (Perpetual). Reference testing performed on HYPE/USDT on Bybit. Timeframe: 15m chart (mandatory β€” strategy is calibrated for this TF). Test Period: Feb 11, 2026 β€” May 13, 2026 (β‰ˆ 3 months). Initial Capital: 2,000 USDT. Order Size per Trade: 28.15 USDT per grid level. Total investment envelope β‰ˆ 1,545.83 USDT (sum of all level allocations). Maximum simultaneous position count: 56 levels. Commission: 0.10% taker β€” Bybit spot reference. Adjust to your venue. Slippage: 2 ticks β€” typical taker execution on liquid spot pairs. Margin for Long and Short Positions: 100% (1Γ— leverage assumed; no margin amplification). Indicator Settings: Default Configuration. Grid Mode: Geometric High Price: 41.31 Low Price: 29.73 Levels: 56 Amount per Level: 28.15 USDT Trailing Up: enabled Trail Up Threshold: 3.0% Shift Up Magnitude: 50% of range Strategy: Long Only.πŸ”· STRATEGY RESULTS ⚠️ Remember, past results do not guarantee future performance. Net Profit: +244.05 USDT (+12.20%) Max Drawdown: 118.35 USDT (5.45%) Total Closed Trades: 1,765 Percent Profitable: 59.04% (1,042 / 1,765) Profit Factor: 1.903 Average Trade: [to fill from Strategy Tester report] Average # Bars in Trades: [to fill from Strategy Tester report] Reference backtest run on BYBIT:HYPEUSDT.P on 15m base chart, Feb 11 β€” May 13, 2026. The 3-month period spans a sideways-to-mildly-bullish phase on HYPE, which is the ideal regime for grid strategies. Re-run on your own venue with venue-specific commission and slippage before drawing conclusions for live deployment.πŸ”· How to Use It: πŸ”Έ Adjust Settings: Set the grid High and Low boundaries based on the instrument's observed range over the past 1–3 months. Use 50–80 levels for high-volatility altcoins, 30–50 for major pairs. The amount per level should be sized so that filling the entire ladder (all 56 levels) does not exceed your risk budget. The default 28.15-USDT structure is calibrated for a 2,000-USDT account; scale linearly to your equity. Always confirm you are on a 15-minute chart β€” the runtime warning label will flag mismatches. πŸ”Έ Results Review: Verify Maximum Drawdown stays within your personal risk budget. The strategy operates with no stop loss, so the worst-case is the full grid being filled at the Low boundary while price continues lower. Calculate this scenario before going live: if every level fills and price drops 10% below the grid Low, what is your unrealized loss? That is your hard floor. Re-test on your own venue with realistic commission and slippage. πŸ”Έ Create alerts to trigger the connected bot: Two alert events are exposed by the strategy β€” "grid_start" fires once when the first bar enters the configured backtest window, and "grid_shift_up" fires every time the trailing-up mechanic moves the grid. Configure both alerts in TradingView with the webhook URL pointing to your bot's signal endpoint. The Bot ID, Email Token, and Pair label can be set in the script's inputs. Note that grid bots are typically configured directly within the bot interface, so these alerts are primarily informational for monitoring purposes.πŸ”· INDICATOR SETTINGS Grid High Price β€” Upper boundary of the grid range. Grid Low Price β€” Lower boundary of the grid range. Grid Levels β€” Total number of price levels between Low and High (default 56). Grid Mode β€” Distribution of levels: Geometric (constant % spacing) or Arithmetic (constant absolute spacing). Amount per Level (USDT) β€” Notional value of each buy fill. Total Investment (USDT, ref) β€” Reference total capital deployed across all levels (informational). Trailing Up β€” Enable grid shift when price exceeds the High threshold. Trail Up Threshold % β€” Percentage above High at which trailing-up triggers. Shift Up Magnitude % β€” How much of the current range to shift when trailing-up fires. Limit by Date Range β€” Constrain backtest to a specific date window. Show grid lines on chart β€” Toggle visual display of all 56 level lines. Recommended TF (for warning) β€” Timeframe baseline for the runtime mismatch warning (default 15m). Stats card / Watermark β€” Display layer controls for on-chart backtest summary and branding. Webhook β€” Bot ID, Email Token, and Pair label for connected bot signal routing.πŸ‘¨πŸ»β€πŸ’»πŸ’­ We hope this tool helps enhance your trading. Your feedback is invaluable, so feel free to share any suggestions for improvements or new features you'd like to see implemented.__The information and publications within the 3Commas TradingView account are not meant to be and do not constitute financial, investment, trading, or other types of advice or recommendations supplied or endorsed by 3Commas and any of the parties acting on behalf of 3Commas, including its employees, contractors, ambassadors, etc.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView