Skip to content

Martingale DCA Strategy

Martingale DCA is a technique that automatically purchases more of a token whenever its price drops below your cost basis by a specified percentage. By doing so, it lowers your average entry price and can potentially help you exit at a profit sooner if the market rebounds. However, it also carries additional risk because you keep adding more capital to a losing position in the hope of a future recovery. This document explains how each Martingale parameter works within the bot configuration.


How Martingale Works

  1. Initial Buy
    You make (or the bot makes) an initial purchase of a token at some price.

  2. Price Drops
    If the market price drops below a certain threshold—defined as a percentage below your current cost basis—the bot automatically executes another buy.

  3. Averaging Down
    Each new buy lowers your overall cost basis, so if the price recovers, you can return to profit sooner.

  4. Repeat
    The process can continue multiple times, each time the price drops below the new threshold, until you reach certain limits. These limits include the maximum number of re-buys or the maximum total amount of base token you’re willing to spend.


Parameters

1. Enable Martingale

  • Type: Boolean (true / false)
  • Meaning: Toggles the Martingale DCA feature on or off for the chosen trading pair.
  • Behavior:
  • If false, the bot will never buy additional tokens when the price falls.
  • If true, the bot will track the price relative to your cost basis and execute re-buys if it goes below your chosen threshold.

2. Step Percent

  • Type: Number (percentage)
  • Meaning: The percentage drop below your current cost basis that triggers a Martingale re-buy.
  • Example:
  • If Step Percent = 5 and your cost basis is \$1.00, the bot will look for the price to go below \$0.95 before re-buying.

3. Scale Factor

  • Type: Number
  • Meaning: Multiplies the buy size each time a Martingale purchase occurs, effectively increasing your position size more aggressively with each subsequent buy.
  • Example:
  • If your Scale Factor is 2, your first re-buy is \$10, the second re-buy will be \$20, the third \$40, and so forth (assuming no other cap is reached).

4. Max Buys

  • Type: Integer
  • Meaning: The maximum number of Martingale re-buys permitted for any single position.
  • Behavior:
  • Once the bot has executed this many additional buys, it will stop re-buys even if the price continues to drop.
  • Prevents an “infinite” Martingale scenario, limiting how many times the bot keeps averaging down.

5. Max Base Amount

  • Type: Number (usually in your base token units, e.g., “SUI” or “USDC”)
  • Meaning: The total amount of your base token you are willing to spend on Martingale re-buys for that position.
  • Behavior:
  • If a new buy attempt would exceed this total usage, the bot either makes a partial buy (the remaining allowed amount) or skips it entirely if no allowance remains.
  • Protects you from over-committing capital in a prolonged downtrend.

If you want to start with 0.1 SUI for your first re-buy, then move to 0.2 SUI, 0.4 SUI, etc., you can configure the parameters as follows:

  • Enable Martingale: true
  • Step Percent: 5
    (Price must drop 5% from your current cost basis to trigger the next re-buy)
  • Min Buy Amount: 0.1 SUI
    (This is how much the first Martingale buy will be)
  • Scale Factor: 2
    (Each subsequent buy doubles the amount of the previous buy)
  • Max Buys: 5
    (Up to five additional re-buys can occur)
  • Max Base Amount: 3.1 SUI (or higher)
  • Explanation: 0.1 + 0.2 + 0.4 + 0.8 + 1.6 = 3.1
  • If you set Max Base Amount to 3.1 SUI, you can fully fund five re-buys as described. If you set this lower, you may not complete all five re-buys. If you set this higher, you have room to accommodate all five and potentially partial buys if the price continues to drop.

With these values:

  1. 1st Re-Buy: 0.1 SUI
  2. 2nd Re-Buy: 0.2 SUI
  3. 3rd Re-Buy: 0.4 SUI
  4. 4th Re-Buy: 0.8 SUI
  5. 5th Re-Buy: 1.6 SUI

After the 5th re-buy, the bot will stop averaging down any further, even if the market continues to drop, because Max Buys has been reached.


Workflow Example

  1. Initial Entry: Suppose your bot buys 100 tokens at \$1.00 each.
  2. Price Drops: The bot sees a 5% drop from your new cost basis (i.e., below \$0.95) and triggers a Martingale re-buy of 0.1 SUI (converted to the target token by the bot).
  3. Price Drops Further: Each time the price falls below an additional 5% from your new cost basis, the bot doubles the buy amount (0.2 SUI, then 0.4 SUI, etc.) until it hits your maximum re-buy count (5 times) or your maximum base usage (3.1 SUI).
  4. Recovery & Sell: When the price eventually rises above your new average cost basis plus your desired profit margin, the bot will sell all tokens to lock in the gains.

Advantages & Risks

Advantages
- Lower Average Cost: By buying more as the price drops, your overall entry price comes down faster.
- Quicker Profit on Rebound: If the market recovers, you might exit profitably sooner than a simple buy-and-hold.

Risks
- Larger Overall Position: You accumulate more tokens, which can increase losses if the market never recovers.
- Potentially High Capital Usage: If the price keeps dropping, you may expend significant capital on re-buys.


Best Practices

  • Set Realistic Limits: Choose a comfortable Max Buys and Max Base Amount so you don’t overextend.
  • Moderate Scale Factor: While a big scale factor can lower your average quickly, it can also consume your funds rapidly.
  • Combine with Profit Targets: Ensure you’ve configured a reasonable profit margin so the bot knows when to sell and lock in gains once the price recovers.

By enabling and customizing these Martingale DCA parameters, you can automate an averaging-down strategy within your trading bot. Always remember that Martingale can amplify both gains and losses. Adjust your configuration according to your personal risk tolerance and trading goals.