DCA Bot
1. What Is a DCA Bot
DCA stands for Dollar Cost Averaging. In traditional investing, DCA means buying a fixed dollar amount of an asset at regular time intervals regardless of price. The GX Exchange DCA Bot takes this concept further by making it reactive to price rather than time.
Instead of buying on a schedule, the bot places an initial base order and then automatically places additional safety orders as the price moves against your position. Each safety order is placed at a lower price (for longs) or higher price (for shorts), which pulls your average entry price toward the current market price. Once the price recovers to your take-profit target measured from the averaged entry, the bot closes the entire position for a profit and starts a new deal.
This approach is sometimes called a martingale-style DCA because the bot can increase the size of each successive safety order, concentrating more capital at better prices. The result is that even a modest price recovery can produce a profitable trade, because the bulk of your position was accumulated near the bottom of the move.
The DCA Bot is the most popular bot type on GX Exchange. It is well-suited to ranging and mean-reverting markets where price dips are temporary. All bot logic runs natively in the Rust matching engine on GXCore, so orders execute with sub-millisecond latency and zero slippage risk from external API delays.
2. How It Works
A single DCA bot cycle is called a deal. Each deal follows these steps:
Step 1 — Wait for Entry Condition The bot monitors the market and waits for the configured entry condition to be met. If the condition is set to Immediate, the bot skips this step and opens a deal right away. Other conditions (RSI, MACD, Bollinger Bands, AI Signal, Webhook) require a specific market signal before the deal begins.
Step 2 — Place Base Order When the entry condition fires, the bot places the base order at the current market price. This is your initial position. For a long bot, it buys; for a short bot, it sells.
Step 3 — Monitor Price and Place Safety Orders If the price moves against the position by the configured deviation percentage, the first safety order triggers. If the price continues to move against you, additional safety orders fire at progressively wider intervals (controlled by the step scale multiplier). Each safety order can also be progressively larger (controlled by the volume scale multiplier).
Step 4 — Track Averaged Entry Price After each safety order fill, the bot recalculates the volume-weighted average entry price across all filled orders. The take-profit target is recalculated relative to this new averaged entry, not the original base order price.
Step 5 — Take Profit or Stop Loss When the market price reaches the take-profit percentage above (long) or below (short) the averaged entry, the bot closes the entire position. If trailing take-profit is enabled, the bot continues to ride the move and only closes when price reverses by the trailing deviation. If the price hits the stop-loss level, the bot closes the position at a loss.
Step 6 — Cooldown and Restart After the deal closes, the bot waits for the configured cooldown period, then starts a new deal by returning to Step 1.
Worked Example
Suppose you run a long DCA bot on ETH-USDT with these settings:
- Base order: $100
- Safety order size: $200
- Max safety orders: 3
- Price deviation: 2%
- Step scale: 1.5
- Volume scale: 1.0 (no scaling)
- Take profit: 1.5%
ETH is trading at $2,000. The bot places a base order buying $100 of ETH at $2,000 (0.05 ETH).
| Event | Price | Order Size | Total Position | Avg Entry |
|---|---|---|---|---|
| Base order | $2,000 | $100 (0.0500 ETH) | 0.0500 ETH | $2,000.00 |
| SO 1 triggers (-2%) | $1,960 | $200 (0.1020 ETH) | 0.1520 ETH | $1,973.68 |
| SO 2 triggers (-5%) | $1,900 | $200 (0.1053 ETH) | 0.2573 ETH | $1,946.19 |
| SO 3 triggers (-9.5%) | $1,810 | $200 (0.1105 ETH) | 0.3678 ETH | $1,904.84 |
After all safety orders fill, the averaged entry is $1,904.84. The take-profit target at 1.5% is $1,933.41. ETH only needs to recover from $1,810 to $1,933 — a 6.8% move — rather than all the way back to $2,000. When it does, the bot closes the full 0.3678 ETH position for a profit.
3. Main Settings
The following table lists every configurable parameter for the DCA Bot.
| Parameter | Type | Range | Description |
|---|---|---|---|
| Pair(s) | String list | Any listed pair | One or more trading pairs the bot will operate on. Multi-pair bots open separate deals per pair. |
| Direction | Enum | Long, Short | Long bots buy low and sell high. Short bots sell high and buy low. |
| Base Order Size | USD amount | Min $10 | The size of the initial order that opens each deal. |
| Safety Order Size | USD amount | Min $10 | The size of the first safety order. Subsequent safety orders may be larger if volume scale is above 1.0. |
| Max Safety Orders | Integer | 1—50 | The maximum number of safety orders per deal. More safety orders means more capital required but wider price coverage. |
| Price Deviation | Percentage | 0.1%—50% | The price drop (long) or rise (short) from the base order that triggers the first safety order. |
| Step Scale | Multiplier | 1.0—2.0 | Controls how the deviation gap grows between successive safety orders. At 1.0, gaps are equal. At 1.5, each gap is 1.5x the previous. |
| Volume Scale | Multiplier | 1.0—3.0 | Controls how safety order sizes grow. At 1.0, all safety orders are the same size. At 2.0, each is double the previous. |
| Take Profit | Percentage | 0.1%—50% | The target profit measured from the averaged entry price. |
| Trailing TP | Percentage | 0.1%—10% | Optional. When set, the bot does not close at the TP level but trails the price and closes when it reverses by this amount. |
| Stop Loss | Percentage | 1%—99% | Optional. If the price falls this far below the base order price (long) or rises this far above (short), the bot closes at a loss. |
| Entry Condition | Enum | See Section 5 | The signal that triggers the start of a new deal. |
| Cooldown | Seconds | 0—86400 | Wait time between a deal closing and the next deal starting. |
| Max Active Deals | Integer | 1—50 | Maximum number of deals that can be open simultaneously across all pairs. |
| Leverage | Integer | 1—100 | Leverage multiplier applied to the position. 1 means no leverage (spot-equivalent). |
| Start Order Type | Enum | Market, Limit | Whether the base order is placed as a market order or a limit order at the current price. |
4. Safety Orders Explained
Safety orders are the core mechanism that makes DCA bots effective. They are pre-computed when the deal starts and placed as conditional orders that trigger when price reaches specific levels.
How Safety Order Levels Are Calculated
Two scaling factors control the placement and sizing of safety orders:
Step Scale (martingale_step_coeff) controls the distance between safety orders. The cumulative deviation from the base price grows as follows:
SO 1 deviation = price_deviation
SO 2 deviation = SO 1 deviation + (price_deviation * step_scale)
SO 3 deviation = SO 2 deviation + (price_deviation * step_scale^2)
...
SO N deviation = SO (N-1) deviation + (price_deviation * step_scale^(N-1))Volume Scale (martingale_volume_coeff) controls the size of each safety order:
SO 1 size = safety_order_size
SO 2 size = SO 1 size * volume_scale
SO 3 size = SO 2 size * volume_scale
...
SO N size = SO (N-1) size * volume_scaleWorked Example: Safety Order Table
Settings: Base price $1,000, price deviation 2%, step scale 1.3, volume scale 1.5, safety order size $200, max safety orders 5 (long direction).
| SO # | Step Size | Cumulative Deviation | Trigger Price | Order Size | Cumulative Cost |
|---|---|---|---|---|---|
| 1 | 2.00% | 2.00% | $980.00 | $200.00 | $200.00 |
| 2 | 2.60% | 4.60% | $954.00 | $300.00 | $500.00 |
| 3 | 3.38% | 7.98% | $920.20 | $450.00 | $950.00 |
| 4 | 4.39% | 12.37% | $876.30 | $675.00 | $1,625.00 |
| 5 | 5.71% | 18.08% | $819.20 | $1,012.50 | $2,637.50 |
Add the base order ($100 at $1,000) and the total maximum investment is $2,737.50. The engine computes and displays this full table before you start the bot so you know the capital requirement upfront.
How Averaged Entry Is Calculated
The averaged entry is a volume-weighted average across all filled orders:
averaged_entry = total_cost_in_usd / total_position_size_in_base_currencyAfter each safety order fills, the take-profit target is recalculated from the new averaged entry. This is why the required recovery shrinks with each safety order — more capital is concentrated at lower prices.
5. Entry Conditions
Entry conditions determine when the bot opens the base order to start a new deal. They apply only to the base order. Safety orders always trigger on price deviation regardless of which entry condition you choose.
| Condition | Description | Best For |
|---|---|---|
| Immediate | Opens the base order as soon as the bot starts (or after cooldown on subsequent deals). No waiting. | Simple setups, markets you want exposure to right away. |
| RSI Oversold | Waits for the Relative Strength Index to drop below a configurable threshold (e.g., RSI < 30) on a chosen period. For long bots, this means the market is potentially oversold. | Buying dips in trending or ranging markets. |
| MACD Cross | Waits for the MACD line to cross above the signal line (bullish crossover for longs). | Catching momentum shifts and trend reversals. |
| Bollinger Band Touch | Waits for the price to touch or breach the lower Bollinger Band (for longs) or upper band (for shorts). | Mean-reversion setups in ranging markets. |
| AI Signal | Uses the GX Exchange built-in AI model to evaluate order flow, volatility, and momentum. The deal starts when the model’s confidence score exceeds a configurable minimum threshold. | Hands-off trading where you trust the model to find optimal entries. |
| Webhook | Waits for an HTTP POST to a unique webhook URL before opening the deal. Compatible with TradingView alerts and custom scripts. | External signal integration, custom strategies, TradingView-based entries. |
Tips for Choosing Entry Conditions
- Immediate is the default and simplest option. Use it when you want the bot to always be in a deal.
- RSI Oversold with a threshold of 25-35 on a 1-hour timeframe is a popular choice for long bots on major pairs. It avoids entering at local tops.
- Webhook gives you the most flexibility. You can connect any external system — a Python script, a TradingView strategy, or another platform’s alerts.
- AI Signal requires no configuration beyond a confidence threshold. Start with 0.7 (70%) and adjust based on results.
6. Take-Profit Settings
The take-profit (TP) target is a percentage measured from the averaged entry price, not from the base order price. This is an important distinction: as safety orders fill and pull the average entry lower (for longs), the absolute price needed to reach the TP target also drops.
Standard Take Profit
When the market price reaches the TP percentage above (long) or below (short) the averaged entry, the bot places a market order to close the entire position. The formula:
Long TP price = averaged_entry * (1 + take_profit_pct / 100)
Short TP price = averaged_entry * (1 - take_profit_pct / 100)A TP of 1.5% with an averaged entry of $1,900 means the bot closes at $1,928.50 for a long deal.
Trailing Take Profit
When trailing TP is enabled, the bot does not close at the TP level. Instead:
- The price reaches the TP target and the trailing mechanism activates.
- The bot records the highest price seen (for longs) or lowest price (for shorts) as the peak.
- As the price continues moving favorably, the peak updates.
- When the price reverses from the peak by the trailing deviation percentage, the bot closes.
This allows the bot to capture extended moves. For example, with TP at 1.5% and trailing deviation at 0.5%, if the price overshoots and reaches 4% above the averaged entry before pulling back by 0.5%, the bot closes at approximately 3.5% profit instead of 1.5%.
When to use trailing TP: In volatile markets where prices tend to overshoot. A trailing deviation of 0.3%—0.5% works well for most pairs.
When to skip trailing TP: In tight-range markets where the price barely reaches TP before reversing. In this case, trailing may cause you to miss the exit and give back the profit.
7. Stop-Loss Settings
The stop loss is optional but strongly recommended. It is calculated from the base order price (not the averaged entry), providing a hard floor on how much the deal can lose.
Long SL price = base_order_price * (1 - stop_loss_pct / 100)
Short SL price = base_order_price * (1 + stop_loss_pct / 100)What Happens When Stop Loss Triggers
- The bot closes the entire position (base order and all filled safety orders) at market price.
- The deal is marked as Stopped Out.
- The bot does not automatically start a new deal after a stop loss. You must manually restart it or have a cooldown configured for restart.
Choosing a Stop-Loss Level
The stop loss should be placed beyond the maximum reach of your safety orders. If your deepest safety order is at -18% from the base price, setting a stop loss at -15% means the stop loss will trigger before the last safety orders can fire, which defeats the purpose.
A general guideline:
- Calculate your maximum safety order deviation (shown in the pre-start table).
- Set the stop loss 5—10% beyond that level.
- For the example in Section 4 (max deviation 18.08%), a stop loss of 25% would be appropriate.
8. Choosing a Strategy: When to Use the DCA Bot
The DCA bot is not the right tool for every market. Here is how it compares to other bot types on GX Exchange.
| Market Condition | Best Bot | Why |
|---|---|---|
| Ranging / sideways | DCA Bot | Repeatedly buys dips and sells recoveries. Thrives in chop. |
| Strong uptrend with pullbacks | DCA Bot (long) | Catches pullbacks and profits on continuation. |
| Tight range with clear support/resistance | Grid Bot | Grid bots profit from many small oscillations; DCA bots need a dip-then-recovery pattern. |
| High-conviction directional trade | Signal Bot | One entry, one exit based on a signal. DCA adds unnecessary complexity for a single move. |
| Unknown direction, want passive exposure | DCA Bot + AI entry | AI picks entries; DCA handles adverse moves. Low-maintenance. |
DCA Bot Strengths
- Recovers from drawdowns that would ruin a single-entry strategy.
- Flexible capital deployment — most capital is only used if the price drops significantly.
- Works on any timeframe, any pair.
DCA Bot Risks
- In a sustained one-directional move (e.g., a prolonged crash for a long bot), all safety orders can fill and the stop loss may trigger, resulting in a large loss.
- Capital is locked while the deal is open. Deep safety orders mean more capital tied up for longer.
- Volume scaling (martingale) amplifies both the recovery advantage and the risk. A volume scale of 2.0 or higher requires careful risk management.
9. Example Configurations
Conservative Long Bot (BTC-USDT)
For a trader who wants steady, low-risk accumulation with moderate capital.
Pair: BTC-USDT
Direction: Long
Base order: $200
Safety order: $400
Max safety orders: 5
Price deviation: 2.5%
Step scale: 1.3
Volume scale: 1.5
Take profit: 1.5%
Trailing TP: 0.5%
Stop loss: 25%
Entry condition: RSI Oversold (period: 14, threshold: 35)
Cooldown: 300 seconds (5 minutes)
Max active deals: 1
Leverage: 1xCapital required: Approximately $5,500 (base order + all safety orders at max volume scale). The bot waits for RSI to indicate an oversold condition, enters, and targets a modest 1.5% with trailing. If BTC drops more than 25% from entry without recovering, the stop loss closes the deal.
Aggressive Multi-Pair Bot (ALT-USDT)
For a trader who wants higher returns on altcoins and can tolerate more risk.
Pairs: ETH-USDT, SOL-USDT, AVAX-USDT
Direction: Long
Base order: $100
Safety order: $200
Max safety orders: 8
Price deviation: 1.5%
Step scale: 1.2
Volume scale: 2.0
Take profit: 2.0%
Trailing TP: 0.8%
Stop loss: 35%
Entry condition: Bollinger Band Touch
Cooldown: 60 seconds
Max active deals: 3
Leverage: 3xCapital required: Approximately $15,000 across all three pairs at maximum deployment (with leverage, margin required is roughly $5,000). The bot opens deals on whichever pair touches the lower Bollinger Band first, up to 3 concurrent deals.
10. Frequently Asked Questions
Q: How much capital do I need to run a DCA bot? A: The bot calculates and displays the maximum possible investment before you start. This is the sum of the base order plus all safety orders at their scaled sizes. You should have at least this amount available in your account. The pre-start summary screen shows the exact figure.
Q: What happens if only some safety orders fill before the price recovers? A: The bot closes the entire position (base order plus however many safety orders filled) when the take-profit target is reached. Unfilled safety orders are cancelled. You still profit; the deal simply used less capital than the maximum.
Q: Can I run a DCA bot on multiple pairs at the same time? A: Yes. You can configure multiple pairs in a single bot. The bot opens separate deals per pair, up to the max active deals limit. Each deal is independent with its own safety orders and take-profit tracking.
Q: Should I use leverage with the DCA bot? A: Leverage amplifies both gains and losses. For conservative setups, 1x (no leverage) is recommended. If you use leverage, reduce your position sizes proportionally and widen your stop loss to avoid liquidation. Never use high leverage with aggressive volume scaling.
Q: How do I choose between a tight take-profit (e.g., 1%) and a wide one (e.g., 3%)? A: A tight TP means more frequent deal completions but smaller profit per deal. A wide TP means fewer completions but larger profit when they close. In ranging markets, tight TP (1—1.5%) is generally better. In trending markets with pullbacks, a wider TP (2—3%) with trailing captures more of each move.
Q: What is the difference between step scale and volume scale? A: Step scale controls where safety orders are placed (the price gap between them). Volume scale controls how much each safety order buys. Step scale of 1.5 means the distance between orders widens by 50% each time. Volume scale of 1.5 means each order is 50% larger than the previous one.
Q: Can I stop or cancel a bot while a deal is open? A: Yes. You can cancel a running deal at any time from the Bot Dashboard. The bot will close the open position at market price and mark the deal as cancelled. Any unrealized profit or loss at the time of cancellation is realized.
Q: Why is the stop loss calculated from the base order price instead of the averaged entry? A: The stop loss is anchored to the base order price to provide a consistent risk boundary. If it were based on the averaged entry, the stop-loss level would shift each time a safety order fills, making it harder to predict your maximum loss. By anchoring to the base price, you always know the worst-case scenario before the deal starts.