DCA for Trading Bots
Dollar Cost Averaging (DCA) in Trading Bots allows strategies to scale into positions with multiple entries. Unlike Signal Bots where you configure DCA levels manually, Trading Bot DCA is controlled by the strategy code.
How DCA Works in Trading Bots
Strategy-Controlled DCA
The strategy author codes the DCA logic directly into the strategy:
- Strategy decides when - The code determines optimal DCA entry points
- Strategy decides how much - Position sizing per level is coded
- System tracks levels - TradeStaq tracks entries and calculates averages
- System manages stop-loss - Based on the strategy's DCA configuration
User Control
As a bot user, you can:
- Enable/Disable DCA - Toggle DCA even if strategy supports it
- View DCA status - See current level and average entry
- Monitor positions - Track all DCA entries
You cannot modify the DCA logic itself - that's defined by the strategy author.
Enabling DCA
During Bot Creation
If the selected strategy supports DCA, you'll see a DCA section in the configuration:
- Navigate to Trading Bots > Create Bot
- Select a DCA-enabled strategy
- In Position Settings, find DCA / Position Scaling
- Toggle Enable DCA (on by default if strategy recommends it)
- Review the max levels and stop-loss mode (set by strategy)
For Existing Bots
- Go to your Trading Bot's detail page
- Click DCA Settings
- Toggle DCA on or off
- View current DCA status
DCA Configuration
Strategy-Defined Settings
These are set by the strategy author and cannot be changed:
| Setting | Description |
|---|---|
| Max Levels | Maximum DCA entries allowed (0 = unlimited) |
| Stop-Loss Mode | How stop-loss adjusts with entries |
| Stop-Loss Adjustment | Percentage for average/trailing modes |
| ATR Settings | Period and multiplier for ATR mode |
| Reset on Close | Whether to reset level counter when position closes |
User-Controllable Settings
| Setting | Description |
|---|---|
| Enable DCA | Toggle DCA on/off for this bot |
Stop-Loss Modes
The strategy defines how stop-loss is managed as DCA entries are added:
None
No automatic stop-loss management. You must set stops manually or via other strategy logic.
Static
The initial stop-loss price is maintained regardless of new entries. Average entry changes but stop stays fixed.
Average
Stop-loss moves to a percentage below (for longs) or above (for shorts) your average entry price.
Average Entry: $48,500
Stop-Loss Adjustment: 2%
New Stop: $47,530 (2% below average)
Breakeven
Stop-loss moves to your average entry price, ensuring no loss if hit (excluding fees).
Trailing
Stop-loss follows price by a fixed percentage, providing dynamic protection as price moves favorably.
ATR (Volatility-Based)
Stop-loss is calculated using the Average True Range indicator, adapting to market volatility:
Stop Loss = Average Entry - (ATR * Multiplier) // for longs
Stop Loss = Average Entry + (ATR * Multiplier) // for shorts
Benefits of ATR stops:
- Wider stops in volatile markets
- Tighter stops in calm markets
- Adapts automatically to conditions
ATR Parameters:
- ATR Period: Number of candles for calculation (typically 14)
- ATR Multiplier: Distance multiplier (typically 1.5-3x)
DCA Status Display
Bot Detail Page
When DCA is active, you'll see:
DCA Status
├── Enabled: Yes
├── Current Level: 3 of 5
├── Average Entry: $48,250
├── Total Position: 0.15 BTC
├── Active Stop-Loss: $47,285
└── Mode: Average (-2%)
Position Information
Each DCA position shows:
- Position Group ID - Links all entries together
- Entry History - Each level with price and size
- Stop-Loss History - How stop has adjusted
- Unrealized P&L - Based on average entry
How Strategy Code Triggers DCA
Strategy authors use the TD API to emit DCA signals:
// Strategy code example
if (shouldDCA) {
td.trade.dcaBuy({
size: td.position.remaining * 0.25, // 25% of remaining allocation
comment: 'DCA Level 2 - Price dropped 3%'
});
}
The strategy determines:
- When to add to position
- How much to add
- Based on what conditions
Best Practices
Choosing DCA Strategies
Look for strategies that:
- Have clear DCA logic - Documented entry conditions
- Use reasonable max levels - 3-5 levels is typical
- Include stop-loss mode - Not set to "None"
- Have been backtested - Validated DCA performance
Risk Considerations
- Position size grows - Each level increases exposure
- Drawdown potential - More entries = more capital at risk
- Recovery requirements - Larger positions need bigger moves to profit
Monitoring
- Check DCA status regularly - Know your current level
- Watch position size - Ensure it stays within limits
- Monitor average entry - Understand your breakeven
- Review stop-loss - Verify it's at expected level
Comparing Signal Bot vs Trading Bot DCA
| Aspect | Signal Bot DCA | Trading Bot DCA |
|---|---|---|
| DCA Logic | You configure levels | Strategy codes it |
| Entry Points | Fixed % deviations | Dynamic conditions |
| Flexibility | Manual setup | Automatic |
| Customization | Full control | Strategy-defined |
| Best For | Custom setups | Automated trading |
Troubleshooting
DCA Not Adding Entries
- Check if enabled - Verify DCA toggle is on
- Check max levels - May have reached limit
- Review strategy logs - See if DCA conditions met
- Verify balance - Ensure sufficient funds
Wrong Stop-Loss Price
- Check stop-loss mode - Understand the mode in use
- Verify average entry - Confirm calculation is correct
- Review ATR settings - If using ATR mode
- Check strategy logs - See stop-loss updates
Position Size Issues
- Review all entries - Check each DCA level size
- Verify sizing mode - Percentage vs fixed
- Check balance - Ensure sufficient margin
- Review strategy parameters - Position sizing settings
Next Steps
- Creating Trading Bots - Full setup guide
- Risk Management - Managing bot risk
- Monitoring - Tracking performance
- Strategies - Available strategies