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:

  1. Strategy decides when - The code determines optimal DCA entry points
  2. Strategy decides how much - Position sizing per level is coded
  3. System tracks levels - TradeStaq tracks entries and calculates averages
  4. 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:

  1. Navigate to Trading Bots > Create Bot
  2. Select a DCA-enabled strategy
  3. In Position Settings, find DCA / Position Scaling
  4. Toggle Enable DCA (on by default if strategy recommends it)
  5. Review the max levels and stop-loss mode (set by strategy)

For Existing Bots

  1. Go to your Trading Bot's detail page
  2. Click DCA Settings
  3. Toggle DCA on or off
  4. View current DCA status

DCA Configuration

Strategy-Defined Settings

These are set by the strategy author and cannot be changed:

SettingDescription
Max LevelsMaximum DCA entries allowed (0 = unlimited)
Stop-Loss ModeHow stop-loss adjusts with entries
Stop-Loss AdjustmentPercentage for average/trailing modes
ATR SettingsPeriod and multiplier for ATR mode
Reset on CloseWhether to reset level counter when position closes

User-Controllable Settings

SettingDescription
Enable DCAToggle 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:

  1. Have clear DCA logic - Documented entry conditions
  2. Use reasonable max levels - 3-5 levels is typical
  3. Include stop-loss mode - Not set to "None"
  4. 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

  1. Check DCA status regularly - Know your current level
  2. Watch position size - Ensure it stays within limits
  3. Monitor average entry - Understand your breakeven
  4. Review stop-loss - Verify it's at expected level

Comparing Signal Bot vs Trading Bot DCA

AspectSignal Bot DCATrading Bot DCA
DCA LogicYou configure levelsStrategy codes it
Entry PointsFixed % deviationsDynamic conditions
FlexibilityManual setupAutomatic
CustomizationFull controlStrategy-defined
Best ForCustom setupsAutomated trading

Troubleshooting

DCA Not Adding Entries

  1. Check if enabled - Verify DCA toggle is on
  2. Check max levels - May have reached limit
  3. Review strategy logs - See if DCA conditions met
  4. Verify balance - Ensure sufficient funds

Wrong Stop-Loss Price

  1. Check stop-loss mode - Understand the mode in use
  2. Verify average entry - Confirm calculation is correct
  3. Review ATR settings - If using ATR mode
  4. Check strategy logs - See stop-loss updates

Position Size Issues

  1. Review all entries - Check each DCA level size
  2. Verify sizing mode - Percentage vs fixed
  3. Check balance - Ensure sufficient margin
  4. Review strategy parameters - Position sizing settings

Next Steps