HeyTraders Documentation

DCA & Scaling Strategies

Average-Down Fixed DCA

Tags: dca, average_down, fixed_amount, risk_high Functions: entry, Notional Description: Adds the same fixed amount on deeper dips. Production DCA accounting does not vary notional size inside one run. Code:

ticker = context["ticker"]
ma = sma(close, 20)

# Initial Entry when in uptrend
is_uptrend = close > ma
emit(is_uptrend, entry(ticker, "LONG", Notional(100), label="DCA_1", accumulate=True))

# Average down with the same fixed notional on each deeper dip
drop_1 = close < (ma * 0.95)
drop_2 = close < (ma * 0.90)

emit(drop_1, entry(ticker, "LONG", Notional(100), label="DCA_2", accumulate=True))
emit(drop_2, entry(ticker, "LONG", Notional(100), label="DCA_3", accumulate=True))

# Exit all on recovery
recovery = close > (ma * 1.05)
emit(recovery, exit_position(ticker))

Time-based DCA (Monday Weekly)

Tags: dca, time_based, monday, accumulation, recurring Functions: Notional, weekday, hour, minute Description: Accumulation investment that buys a fixed amount each Monday using calendar variables. Code:

ticker = context['ticker']

# ISO weekday: Monday=1 ... Sunday=7
monday_open = (weekday == 1) & (hour == 0) & (minute == 0)

emit(monday_open, entry(ticker, 'LONG', Notional(1000), accumulate=True))