Scalping Algorithm Development
Scalping is a trading strategy with very high trade frequency and minimal profit targets per position (0.1–0.5%). Algorithmic scalpier makes tens or hundreds of trades per day, earning on small price moves with high volume.
Requirements for Scalping System
Latency: delay between signal reception and order execution must be minimal. VPS in same data center as exchange. For Binance — AWS Tokyo (ap-northeast-1), for Bybit — similar.
Fees: with 0.1–0.2% target, taker fee 0.04–0.07% eats significant portion. Must either use limit orders (maker fee 0–0.02%), or have sufficiently high win rate and R:R.
Slippage: minimal on instruments with deep order book. BTC/USDT and ETH/USDT on major exchanges — minimal slippage.
Scalping Strategies
Order book imbalance scalping: on bid/ask imbalance > 3:1 or 1:3, expect short-term move in corresponding direction. Fast limit order entry, target 0.1–0.15%, stop 0.1–0.15%.
Tape reading (tick data): analysis of trade flow (aggTrades). Series of large trades in one direction = aggressors push price.
Spread scalping with rebate: place limit orders on bid and ask, earn spread + maker rebate. Essentially market making at micro level.
Microstructure momentum: first 5–10 candles after strong move often continue direction. Enter in impulse direction, quick exit.
Position Management
Hard stop-loss: fixed stop 0.15–0.2% (depends on instrument). Don't hold losing position hoping for reversal — kills scalping.
Time-based exit: if after N seconds/minutes position hasn't shown profit — close. Time = money in scalping.
Maximum daily loss: on reaching max daily loss (e.g., 2% capital), algorithm auto-stops.
Maximum daily trades: limit trade count prevents overtrading in poor market conditions.
Scalping Backtesting
Standard OHLCV backtesting insufficient for scalping — need tick data or 1-second bars. Accounting for slippage, spread, fees is critical.
Realistic backtesting: use aggTrades data (Binance provides historical) with simulated order book execution. Assume partial fill on large limit orders.
Metrics: profit factor (gross profit / gross loss) > 1.5, average profit / average loss > 1.2, max drawdown < 5%, sufficient trade count for statistical significance.
Stack: Python (asyncio + websockets) or C++ for minimal latency, ClickHouse for tick data storage, Grafana for real-time P&L monitoring. Algorithm runs as daemon with auto-reconnect on WebSocket connection break.







