Professional Grid Trading Strategy
An automated grid trading tool for spot and futures markets.
Overview
Grid trading is a method that automatically buys low and sells high during price fluctuations. This strategy divides the price range into multiple grids, automatically buying when price drops to a grid level and selling when it rises, repeatedly capturing profits from market volatility.
This strategy has been refactored with a modular design, featuring clean and clear code, supporting both spot and perpetual futures markets.
Features
Flexible Grid Configuration
- Arithmetic Grid: Fixed price difference per grid, suitable for narrow-range oscillation
- Geometric Grid: Fixed percentage per grid, suitable for wide-range volatility
- Multiple Directions: Long, short, or bidirectional options
Diverse Position Sizing
- Equal Sizing: Same quantity per grid, evenly distributed risk
- Martingale: Buy more as price drops, suitable for bottom fishing
- Anti-Martingale: Buy less as price drops, controls downside risk
- Pyramid: Larger positions in the middle, smaller at the edges
Comprehensive Risk Control
- Stop Loss: Automatic handling when loss reaches threshold
- Take Profit: Option to secure gains when profit target is met
- Drawdown Protection: Triggers when profit drops too much from peak
- Position Limit: Prevents overexposure in trending markets
- Price Range: Restricts grid operation within defined boundaries
Smart Operations
- Dynamic Orders: Only places real orders when price approaches, reducing API usage
- Auto Move: Automatically re-grids when price deviates from grid range
- Idle Move: Adjusts grid position after prolonged inactivity
- Real-time Dashboard: Displays positions, P&L, grid status and key metrics
Convenient Controls
- Close All: Flatten positions and stop strategy
- Pause/Resume: Temporarily halt trading
- Emergency Close: Quick market liquidation
- Reset Grid: Rebuild grid positions
Use Cases
| Market Condition |
Recommended Usage |
| Sideways Market |
Bidirectional grid to capture oscillations |
| Bullish Trend |
Long grid, add on dips |
| Bearish Trend |
Short grid (futures), add on rallies |
| High Volatility |
Geometric grid + wider spacing |
| Low Volatility |
Arithmetic grid + narrower spacing |
Important Notes
- Grid strategies perform better in ranging markets; trending markets may cause significant floating losses
- Futures trading involves leverage, which amplifies both gains and losses
- Recommend testing on paper trading first, then start with small capital
- Please set stop loss according to your risk tolerance
Technical Details
- Supported Markets: Spot, USDT Perpetual Futures