Backtesting Grid Strategies

🟣 Avanzado · 2025-03-28

Backtesting Grid Strategies

Backtesting lets you evaluate a grid configuration against historical price data before risking real capital. It answers the question: if I had run this exact grid setup over the past month, what would have happened? While backtesting cannot predict future performance, it te ayuda a identify configurations that are fundamentally flawed before they cost you money.

How to Run a Backtest in Gridera

  1. Open tu bot’s detail page and scroll to the Backtest panel.
  2. Enter your grid settings: Grid Baja, Grid Alta, Number of Grids, Total Budget, and Leverage.
  3. Select a time period (1 Day to 3 Months) or set a custom date range.
  4. Click Run Backtest.

The system fetches real historical price data from Pacifica and simulates your exact grid strategy. Results include: Net PnL, ROI, Win Rate, Total Trades, Total Fees, Max Drawdown, and Open Positions.

What Backtesting Simulates

A grid backtest replays historical price data through your grid configuration and tracks:

  • Total trades executed: How many buy-sell round trips completed.
  • Realized profit: The sum of all completed grid trades minus fees.
  • UnPnL realizado: The value of positions still held at the end of the test period.
  • Maximum drawdown: The worst peak-to-trough decline during the period.
  • Grid break events: Whether and cuando el precio exited your range.
  • Capital utilization: What percentage of tu capital was actively deployed.

The simulator processes each price candle, checks which nivel de grids would have been crossed, and executes the corresponding compra y venta orders at el grid prices.

Setting Up a Backtest

To run a meaningful backtest, necesitas:

Historical price data: OHLCV (Open, Alta, Baja, Close, Volume) candles for your asset. Use 1-minute or 5-minute candles for accurate results. Daily candles miss intraday oscillations and dramatically undercount grid trades.

Grid configuration: The same parameters you would use live: grid low, grid high, number of levels, tamano de orden, leverage, fees, and any bias mode settings.

Starting conditions: Initial capital, starting price, and si you begin with empty or pre-filled grid positions.

Fee model: Include maker/taker fees and, for futuros perpetuos, tasa de financiacion estimates. Backtests that ignore fees produce misleadingly positive results.

Interpreting Results

Focus on these metrics when evaluating backtest results:

Net profit after fees: Este es el only number that matters for viability. If the net profes negative or barely positive after fees, la configuracion needs adjustment independientemente de how many trades it generated.

Drawdown-to-profit ratio: Divide drawdown maximo by total profit. A ratio below 2 means you risked at most $2 for every $1 earned, que es acceptable. A ratio above 5 suggests el riesgo is not worth the return.

Trade frequency: More trades generally mean more robust results. A backtest with 200 completed round trips is much more statistically meaningful than one with 10.

Time in drawdown: How long was la estrategia underwater? Extended drawdown periods (weeks) indicate la configuracion may be poorly suited for the tested condiciones de mercado.

Limitations of Backtesting

Backtesting has significant limitations that you must understand:

No slippage modeling: Real markets have slippage, especially during volatile periods. A backtest fills every order at the exact grid price, which does not always happen in practice.

Candle resolution matters: Using hourly or daily candles means you only know the open, high, low, and close, not the actual path el precio took. El precio might have hit your nivel de grids in a different order than the backtest assumes.

Survivorship bias: Si backtest 20 configurations and pick the best one, estas fitting to datos historicos. The best past configuration is not necessarily the best future configuration.

Market impact ignored: In real trading, tu ordens affect el mercado. Large grid orders can move el precio, especially in thin markets. Backtests assume tu ordens have zero market impact.

Regime changes: A backtest on sideways market data will show grid trading is profitable. A backtest on trending data will show es not. Historical conditions do not repeat exactly.

Mejores Practicas

Test multiple periods: Run el mismo configuration against at least three different time periods, including bullish, bearish, and sideways markets. A good configuration survives all three, even if returns vary.

Use realistic fees: Siempre include fees in your backtest. A configuration that looks profitable at 0% fees but fails at 0.04% round-trip fees was never truly profitable.

Compare against benchmarks: Compare your grid bot results against simple buy-and-hold for el mismo period. In strong trends, buy-and-hold often wins. In sideways markets, el grid should outperform.

Stress test with extreme data: Include at least one period with a major crash (30%+ drop in days) in your test data. This reveals how tu configuracion handles tail events and si your grid break and stop loss settings would have protected you.

Walk-forward testing: Instead of testing on the entire dataset at once, test on el primer half, optimize, then validate on the second half. Esto reduce overfitting to datos historicos.

From Backtest to Paper Mode

Backtesting gives you historical validation. The next step before going live is paper mode, which tests tu configuracion against en tiempo real market data sin risking capital. This bridges the gap between historical simulation and live trading by testing execution mechanics, WebSocket feeds, and timing in real conditions.

Resumen

  • Backtesting replays historical price data through your grid configuration to estimate profitability, drawdown, and trade frequency.
  • Siempre include realistic fees, test across multiple market regimes, and compare against buy-and-hold benchmarks.
  • Backtests have inherent limitations including no slippage, candle resolution assumptions, and inability to predict regime changes.

Siguiente Paso

Move from historical testing to en tiempo real simulation with Paper Mode Guide.

✨ Te fue util este articulo?

Haz tus preguntas en Discord →