Example strategy

DCA bot strategy: a safety-order ladder you can fork

A DCA bot buys once, buys again each time the price drops a set amount below its last buy, and sells everything when the price rises a set amount above its average cost. Below is that rule as a Keel strategy. Fork it, change the coins, the spacing, the number of buys and the take profit, then backtest it on Hyperliquid data before you run it.

By Keel Research Team
Updated October 18, 2026

The whole strategy, block by block. It runs on BTC, ETH, SOL, XRP and DOGE, each coin on its own ladder.

Fork this DCA bot

Opens it in Keel as your own draft, to change and backtest.

Configuration

Globalsconfig
target_timeframe4h
UniverseassetsManual · HL Perps · 5 symbols5 resolved
Executionorders
rebalanceOn Change
Pipeline10 steps
PriceDataLoaderData Loader
ohlcvstore
RSIIndicator
period14
BelowThresholdFilterSignal Transform
threshold40
entriesstore
TradeManagerPosition Manager
entriesentriespricesohlcv
Parallel2 branches
safety_order
ReturnSinceLastFillPosition Manager
BelowThresholdFilterSignal Transform
threshold-0.03inclusivetrue
ScaleInPosition Manager
units1times4
take_profit
ReturnFromAveragePosition Manager
AboveThresholdFilterSignal Transform
threshold0.03inclusivetrue
ExitPosition Manager
ExposurePosition Manager
FixedWeightSizerPosition Sizer
weight_per_position0.04
LeverageCapRisk Manager
max_leverage1

What Keel does instead of a DCA bot

Keel runs DCA as a rule, not as a bot on an exchange. You describe the rule (or let AI build it), backtest it on real Hyperliquid data, paper trade it, then run it on Hyperliquid perpetual futures.

DCA on Keel means a safety-order ladder: add on each drop, exit from the average, filled at the close of each 4h bar, on a perp that pays or earns funding while the deal is open. It doesn't make recurring buys of new cash.

How this DCA bot works

Each coin runs its own deals. A deal is a base buy, safety orders and a take profit, each a single line in the strategy, and one sizer sets how big every buy is.

  1. Base buy

    A deal starts when RSI(14) on the 4h chart is below 40. The first buy is 4% of the account. After a deal closes, the next one waits for RSI to rise back to 40 or above and drop below it again.

  2. Safety orders

    Each time the price closes 3% or more below the last buy, the strategy buys the same size again, up to 4 more times. With every safety order filled, one coin holds 20% of the account.

  3. Take profit

    When the price closes 3% above the average price of all the buys, the whole deal is sold.

  4. Size

    Every buy is 4% of the account, and the whole strategy is capped at 1x the account across all coins. Orders fill at the close of the bar.

The settings people usually change

These are the knobs a DCA bot has, and where each one lives in the strategy after you fork it.

SettingIn this exampleWhere it livesWhat changing it does
CoinsBTC, ETH, SOL, XRP and DOGEUniverse(symbols=[...])Add or remove coins. Each one runs its own ladder.
Start conditionRSI(14) below 40RSI(period=...) and the BelowThresholdFilter after itRaise the level to start deals more often, lower it to wait for deeper dips.
Safety-order spacing3% below the last buysafety_order: BelowThresholdFilter(threshold=...)Wider spacing buys less often and covers a deeper fall with the same buys.
Number of safety orders4safety_order: ScaleIn(times=...)More safety orders cover a deeper fall and make the full deal bigger.
Take profit3% above the averagetake_profit: AboveThresholdFilter(threshold=...)A higher target makes each deal last longer.
Size per buy4% of the accountFixedWeightSizer(weight_per_position=...)Keep size per buy × (1 + safety orders) × coins within what you want at risk.
Timeframe4hGlobals(target_timeframe="...")A shorter timeframe checks the rules and fills more often; a longer one less often.

Change the coins and rules after you fork

Fork it

The fork button opens this exact strategy in Keel as your own draft. Nothing runs until you backtest it, paper trade it or deploy it.

Switch coins

Edit the symbols list in the Universe line and save. Keel checks the new list when you save and drops any coin it cannot trade.

Change the rules

Change the numbers in the safety_order and take_profit lines, or swap the RSI start condition for any other entry signal. Backtest after each change and compare the runs.

Add a stop loss

The example has no stop. To add one, put a third rule next to the other two, "stop": [StopLoss(pct=...)], with the loss from the entry price you are willing to take. The deal then closes at the first bar close past that loss.

Paper trade before you go live

Run the forked strategy on paper first: live Hyperliquid prices, simulated money, no wallet. When it behaves the way you expect, run it from your own Hyperliquid account.

The start condition is an RSI rule; see how the RSI strategy backtests on its own, browse more backtested strategies, or read how paper trading on Keel works.

One backtest of this example

One backtest of this exact strategy on BTC, ETH, SOL, XRP and DOGE, 2024-08-15 to 2026-09-29: 52 deals closed, 100% of them in profit. Total return -19.6%, worst drawdown 49.7%, funding paid 8.3% of the account.

Deals close in profit because each one waits for its target, while a deal that is still open can hold a loss for a long time. Size the ladder so that a full deal on every coin is an amount you can leave open.

Backtest data through 2026-09-29 on Hyperliquid perpetuals, net of fees, slippage and funding. Costs: 4.5bp fee + 4.5bp slippage per trade (9bp round-trip); funding included.

FAQ

DCA bot questions

What is a DCA bot?

A DCA bot buys a coin in steps. It makes a first buy, adds more each time the price falls by a set amount, and sells the whole position once the price climbs a set amount above the average cost of all the buys.

Do DCA bots work?

A deal only closes at its target, so the deals that close are wins. The risk sits in the deals that don't close: in a long fall every safety order fills and the position holds a loss until the price comes back. Backtest the exact settings on the coins you want before you run them.

What is a safety order?

A safety order is a buy the bot makes when the price drops a set amount below its last buy. It lowers the average price, so the deal needs a smaller bounce to reach the take profit. This example places up to 4, each 3% below the last.

Is DCA the same as martingale?

No. This example adds the same size on every safety order. Martingale doubles the size on each add, so the position grows much faster as the price falls, and so does the loss if it keeps falling.

Can Keel do recurring buys?

No. Keel doesn't buy a coin with new cash on a schedule. It runs rules on Hyperliquid perpetual futures inside a fixed account, so a ladder like this one adds to a perp position and pays or earns funding while the deal is open.

Can I add a stop loss to the DCA bot?

Yes. After you fork it, add a rule "stop": [StopLoss(pct=...)] next to the take profit. The deal then closes at the first bar close past that loss from the entry price.