> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dyxy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DCA bot

> Build a position in steps, average your entry, and take profit on the rebound.

DCA stands for **dollar-cost averaging**. The DCA bot opens a position with a base order. If the price moves against you, it adds to the position with safety orders at preset levels, lowering your average entry price. When the price recovers by your take-profit target, measured from that average, the bot closes the whole position and starts a new round.

## How a round works

**1. Base order**

The bot opens the position with the base order, immediately or when the trigger price is reached.

**2. Safety orders**

Each time the price moves against you by the price deviation, the bot places the next safety order. Your average entry price improves with every fill.

**3. Take profit**

When the price moves in your favor by the take-profit percentage from the average entry, the bot closes the whole position.

**4. Next round**

After a short cooldown, a new round starts with a new base order.

## Parameters

| Parameter | What it does |
| - | - |
| **Direction** | **Buy** (long) accumulates when the price falls and sells on the rebound. **Sell** (short) does the opposite |
| **Base order** | Size of the first order in each round |
| **Safety order** | Size of the first safety order |
| **Max safety orders** | How many safety orders the bot can place in one round |
| **Price deviation** | How far the price must move from the base order to trigger the first safety order, in percent |
| **Safety order size multiplier** | Scales each next safety order. At 2, every safety order is twice the previous one |
| **Price deviation multiplier** | Scales the gap between each next pair of safety orders, so later orders sit further away |
| **Take profit** | Profit target per round, measured from the average entry price. **Fixed** closes at the target. **Trailing** keeps riding the move and closes after a set pullback |
| **Stop loss** (optional) | Loss from the average entry at which the round ends. You can choose to stop the whole bot when it triggers |
| **Trigger price** (optional) | Starts the bot only when the price reaches this level |
| **Price range** (optional) | Limits the range in which a new base order can open |
| **Leverage** (futures only) | Multiplies position size and risk |

**Total investment = base order + all safety orders**, including the effect of the size multiplier.

## Example

Buy-side DCA bot on ETH at \$4,000:

* Base order: \$100
* Safety order: \$100, multiplier 1
* Max safety orders: 2
* Price deviation: 5%
* Take profit: 3%

| Step | ETH price | Bought | Total invested | Average entry |
| - | - | - | - | - |
| Base order | \$4,000 | 0.0250 ETH | \$100 | \$4,000 |
| Safety order 1 (−5%) | \$3,800 | 0.0263 ETH | \$200 | about \$3,898 |
| Safety order 2 (−10%) | \$3,600 | 0.0278 ETH | \$300 | about \$3,793 |

Take profit triggers at 3% above the average, about $3,907. The bot sells 0.0791 ETH for about $309, a profit of about $9 on the round before fees. Note that the price only had to recover to $3,907, still below the original \$4,000 entry.

## Choosing settings

* **Tighter deviation and more safety orders** fill more often and take profit sooner, but use up your budget faster in a deep drop.
* **Wider deviation, or a deviation multiplier above 1,** keeps firepower for larger drops.
* **A size multiplier above 1** lowers the average entry much faster, but makes later orders much larger. Check the total investment before starting.
* **Make sure the total investment covers every safety order.** If the bot runs out of safety orders, it simply holds the position until the take profit or stop loss is hit.

> [!WARNING]
>
> On a futures DCA bot, every safety order increases your position and moves your liquidation price. Check the liquidation price shown for the worst case, with all safety orders filled, before you start.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.