HeyTraders Documentation

DCA Template

The DCA template accumulates a position in repeated increments. Use it when position-building matters more than timing a single entry.

DCA can keep adding exposure while a market moves against you. Set a clear maximum allocation and test the schedule in paper trading before live trading.

Template DSL

ticker = context['ticker']
dca_cond = close > 0

emit(dca_cond, entry(ticker, 'LONG', Notional(100), accumulate=True))

Run this template with strategy_type: "dca". DCA still uses Signal DSL, but the semantic type tells the backtest runner to enable DCA accounting. If every entry uses the same fixed notional amount, also pass dca_fixed_amount.

{
  "strategy_type": "dca",
  "script": "ticker = context['ticker']\ndca_cond = close > 0\nemit(dca_cond, entry(ticker, 'LONG', Notional(100), accumulate=True))",
  "universe": ["HYPERLIQUID.xyz:AAPL/USDC:USDC"],
  "exchange": "hyperliquid.xyz",
  "timeframe": "1d",
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "dca_fixed_amount": 100
}

The generated template can be combined with time filters, maximum position checks, or exit logic when you need stricter risk control.

What to Test

Decide whether accumulation is time-based, signal-based, or both. Then test the interval, fixed amount, total allocation cap, and the condition that stops new entries. A constant true condition such as close > 0 is only a minimal example; without a scheduler or additional guard it may add exposure more often than intended.

Review how the strategy behaves through a prolonged decline, not only during a rising market. Compare the average entry price, maximum capital deployed, drawdown, and number of increments. Before live trading, add an explicit maximum position or allocation check, verify the exchange's minimum order size, and confirm whether an exit or rebalance rule is required. Paper trading can confirm the schedule and repeated-entry behavior without sending real orders.