DCA bot calculator: safety orders, deviation, funds needed
Running a grid on gold?The Midas Grid emulator replays any gold day since January 2025 tick by tick with your grid settings. Free, in the browser.
How DCA bot safety orders are calculated
Each safety order opens further from the base order price than the previous one — the gap grows by the step scale — and is larger by the volume scale.
deviation_n = d × (1 + k + k² + … + k^(n−1))Deviation of safety order n from the base order price, in %. d — price deviation, k — step scale. With d = 1 % and k = 2: 1 %, 3 %, 7 %, 15 %.price_n = P0 × (1 − deviation_n ÷ 100)Price of safety order n of a long bot; a short bot adds the deviation.size_n = S × v^(n−1)Size of safety order n in the quote currency. S — safety order size, v — volume scale.average = Σ size ÷ Σ (size ÷ price)Average price: the money invested divided by the coins bought.TP = average × (1 + tp ÷ 100)Take-profit price of a long bot; a short bot uses (1 − tp ÷ 100).rebound_n = (TP_n − price_n) ÷ price_n × 100How far the price must come back from safety order n to reach the take profit, in %.
Worked example
A long bot: start price 100, base order $100, safety order $100, 3 safety orders, price deviation 10 %, step scale 1, volume scale 2, take profit 2 %. The safety orders open at 90, 80 and 70 for $100, $200 and $400.
| Order | Deviation | Price | Order size | Coins | Total invested | Average price | Rebound to TP |
|---|---|---|---|---|---|---|---|
| Base | 0% | 100 | $100 | 1.0000 | $100 | 100.00 | 2.00% |
| SO 1 | 10% | 90 | $100 | 1.1111 | $200 | 94.74 | 7.37% |
| SO 2 | 20% | 80 | $200 | 2.5000 | $400 | 86.75 | 10.60% |
| SO 3 | 30% | 70 | $400 | 5.7143 | $800 | 77.48 | 12.90% |
| Coins bought | 100 ÷ 100 + 100 ÷ 90 + 200 ÷ 80 + 400 ÷ 70 = 1 + 1.1111 + 2.5 + 5.7143 = 10.3254 |
| Average price | 800 ÷ 10.3254 = 77.48 |
| Take-profit price | 77.48 × 1.02 = 79.03 |
| Rebound from the last safety order | (79.03 − 70) ÷ 70 = 12.90% |
| Funds required | 100 + 100 + 200 + 400 = $800 |
The orders cover a fall of 30 % from the start price. Open the example in the calculator to see the same rows.
How much money a DCA bot needs
A DCA bot needs the base order plus every safety order in the quote currency; on futures the margin is that total divided by the leverage.
funds = B + S × (1 + v + v² + … + v^(N−1))B — base order, S — safety order, v — volume scale, N — max safety orders.margin = funds ÷ LWith futures leverage L. The liquidation then depends on the balance you keep, see below.
Example: B = $100, S = $100, v = 2, N = 3: 100 + 100 × (1 + 2 + 4) = $800; with 5× leverage 800 ÷ 5 = $160 of margin.
| Max safety orders | Volume scale 1 | Volume scale 1.5 | Volume scale 2 |
|---|---|---|---|
| 3 | $40.00 | $57.50 | $80.00 |
| 5 | $60.00 | $141.88 | $320.00 |
| 7 | $80.00 | $331.72 | $1 280.00 |
| 10 | $110.00 | $1 143.30 | $10 240.00 |
The price range the orders cover grows the same way: the deviation of the last safety order is d × (1 + k + … + k^(N−1)).
| Max safety orders | Step scale 1 | Step scale 1.2 | Step scale 1.5 |
|---|---|---|---|
| 3 | 3.00% | 3.64% | 4.75% |
| 5 | 5.00% | 7.44% | 13.19% |
| 7 | 7.00% | 12.92% | 32.17% |
| 10 | 10.00% | 25.96% | — |
A dash: the last safety order of a long bot would be more than 100 % below the start, at a price of zero or below.
Liquidation price of a DCA bot with leverage
With leverage the balance backs a position several times larger, so the bot is liquidated where the loss of the filled orders brings equity down to the maintenance margin.
P_liq = (A − F) ÷ (Q × (1 − MMR))Long bot with cross margin. A — money in the filled orders, Q — coins, F — balance. A short bot: (F + A) ÷ (Q × (1 + MMR)).P_liq before price_(n+1) → the next safety orders never openThe equation is solved after every safety order, so the liquidation can come before the last one.
Example (the bot above at 5×, balance = funds required = $160, MMR 0.5 %): (800 − 160) ÷ (10.3254 × 0.995) = 62.29, 37.71 % below the start and 7.71 below the last safety order.
| Leverage | Balance | Liquidation price | Where |
|---|---|---|---|
| 1× | $800.00 | — | none above zero |
| 2× | $400.00 | 38.93 | 31.07 beyond the last SO |
| 3× | $266.67 | 51.91 | 18.09 beyond the last SO |
| 5× | $160.00 | 62.29 | 7.71 beyond the last SO |
| 10× | $80.00 | 70.00 | as SO 3 fills |
At 10× a balance equal to the funds required is used up by the time the third safety order fills. Exchanges also count the unrealised loss when they check the margin for a new order, so that order may be rejected instead; the calculator shows the balance this check needs.
For any grid with a deposit, a stop-out level on MT4/MT5 or a maintenance margin on an exchange use the grid bot risk calculator. For gold on a cent account: the martingale grid calculator.
Formulas and worked example
With the default settings — base order $10, 5 safety orders starting at $10 and growing ×1.5, a first deviation of 1.5% and step scale ×1.2 — the last safety order sits 11.16% below the start price, the bot needs $141.88 in total, and with every order filled the average price is 92.63 (start 100), so the 1.5% take profit is a 5.84% rebound from the last order.
Reviewed
Frequently asked questions
How do safety orders work in a DCA bot?
The bot opens a base order and places safety orders at set distances against the position. Each safety order that fills moves the average price towards the market, so a smaller rebound reaches the take profit. The distance starts at the price deviation and grows by the step scale; the size grows by the volume scale.
How much money do I need for a DCA bot?
The base order plus all safety orders: funds = B + S × (1 + v + … + v^(N−1)). With a $10 base order, $10 safety orders and 5 safety orders that is $320 at volume scale 2 (10 + 10 × 31) and $141.88 at 1.5. With futures leverage the margin is that sum divided by the leverage, but the liquidation then depends on the balance you keep.
What does safety order step scale mean?
It multiplies the gap between consecutive safety orders. With a 1 % price deviation and step scale 1 the orders sit 1, 2, 3 and 4 % from the base order; with step scale 2 they sit at 1, 3, 7 and 15 %. A larger step scale covers a deeper fall with the same number of orders, but the orders are further apart.
What does safety order volume scale mean?
It multiplies the size of each next safety order. With a $10 safety order and volume scale 2 the orders are $10, $20, $40 and $80; with 1.5 they are $10, $15, $22.50 and $33.75. A larger volume scale pulls the average price closer to the last order but needs much more money.
How far can the price fall before all safety orders are used?
As far as the deviation of the last safety order: d × (1 + k + … + k^(N−1)). With a 1 % price deviation, step scale 1.2 and 7 safety orders that is 12.92 %. Beyond it the bot has no orders left and holds the position until the price comes back or the deal is closed.
What is the liquidation price of a DCA bot on futures?
With cross margin it is the price where equity falls to the maintenance margin: for a long bot (A − F) ÷ (Q × (1 − MMR)), where A is the money in the filled orders, Q the coins and F the balance. It moves closer to the market price with every safety order that fills, and with high leverage it can come before the last safety order.
Is a DCA bot safe?
No strategy that keeps adding to a losing position is safe. A DCA bot closes many small deals while the price comes back, but a long one-way move uses every safety order, leaves a large open loss and, with leverage, can liquidate the whole balance. The calculator shows the arithmetic of your settings, not the chance of such a move.
About this calculator
Enter the settings of a DCA bot as 3Commas, Bybit, Binance or Veles name them and see every safety order: its deviation, price and size, the money invested, the average price and the rebound to take profit — and with futures leverage, the liquidation price.
Share this scenario
Midas Grid is a grid Expert Advisor for gold on MT5.Its panel shows the distance to stop-out for a live account, the same kind of arithmetic as on this page.