Skip to main content

Spotgridadvanced

A grid like strategy with dynamic trading targets and integrated trailing for both buying and selling.

Based on spotgrid, with additional configuration options, trend detection and 'continuous trading'.

Regular trading behavior

When you run spotgrid on a pair in an uptrend, this is the kind of trading behavior to expect:

Typical spotgrid trades. Green arrows are buys, orange arrows are sells.

Let's break down what actually happens:

  • When the strategy first runs and there is no balance to sell, it immediately places a market buy order
  • If price goes down and it exceeds the spotgrid line in the chart, buy trailing is activated. As soon as trailing finishes, a buy order is placed. The break even price is now lower.
  • If price reaches the Sell target on the chart, sell trailing is activated and the complete position is sold at profit when trailing finishes.
  • After having sold, the strategy immediately starts buy trailing. If price goes up it will quickly open a new position, if price goes down it will place a buy order below the last sell rate.

You will see that the first few buy orders happen fairly quickly when price starts going down. After a few trades, the price distance between buy orders gets much bigger. All targets are set automatically.

When the market goes down, the strategy starts to accumulate units at ever lower prices:

Slowly accumulating with same sized orders

The bot will continue to accumulate until max buy count is hit, or when it run out of available funds. Every new buy order will lower the break even price. As soon as price hits the sell target and finishes trailing above break even, a sell order is placed.

Balance management is very important, make sure you can afford the planned number of buy orders.

tip

The next trading targets are always visible on the chart.

Keep in mind the targets lines are moving over time, they represent the current targets.

Continuous trading behavior

CT, short for 'continuous trading', is a mechanism that lets you keep trading profitably even when the current price is far below the overall break even price.

The principle is very simple: if price is above the price of the last buy order, up to the number of units bought in this trade can be sold for a small profit in base and in quote. The base profits you keep, the quote profits can help bring down break even of the overall position.

Besides the small profits from these partial trades, it allows your strategy to follow the market price more closely and sometimes fit in more DCA trades in one price range, compared to only waiting for prices to go down further to DCA.

Continuous trading example

The chart above shows several CT trades. Each sell order on this chart is only working with the units bought with the previous buy order. The number of units to 'CT sell' is configurable using the continuous trading limit multiplier, setting this to 1 would sell approx. the same number of units as last bought, 0.5 would sell approx. half of the units last bought.

What happens when?

Assuming your settings allow CT orders:

  • When price goes down after a DCA order: another DCA order gets placed when grid DCA target is hit.
  • When price goes up after a DCA order: CT sell target is set above last buy rate, using 'gain' or 'auto gain'. When the target is reached, a CT sell order is placed.
  • When price goes down after a CT sell order: if grid DCA target is reached, a 'CT buy' order is placed for approx. the same number of units as the CT sell order. The position size after this order is more or less identical compared to before the CT sell order.
  • When price goes down after a CT buy order: a normal DCA order is placed when the DCA target hits.
  • When price goes up after a CT sell order: if price is below break even and the distance between last sell rate and current price is more than the distance between first support and resistance, a new CT buy order gets placed.
tip

Manual trading or changing settings related to trading limit can disrupt continuous trading.

If you use CT, make it a habit to only change trading limit settings after a complete sell order.

SpotGridAdvanced settings

Balance settings

LabelConfig ParameterDefault ValueDetailed Description
Trading limitTRADING_LIMIT20The amount you invest for each individual buy order. This value represents the base amount for the first buy order if you are using a trading limit multiplier.

It's essential to adapt this amount according to your trading strategy and capital availability.
Trading limit multiplierTL_MULTIPLIER1Adjusts the invested amount incrementally with each consecutive buy order. For example, with a trading limit of 100 USDT and a max buy count of 3:

- 1: Each order is 100 USDT.
- 1.5: First order 100 USDT, second 150 USDT, third 225 USDT.
- 2: First order 100 USDT, second 200 USDT, third 400 USDT.

This setting helps in scaling the investment based on market conditions and strategy evolution.
Max buy countMAX_BUY_COUNT15Limits the maximum number of buy orders to prevent overexposure. For example, a value of 15 means the total position size may not exceed 15 times the amount set as 'trading limit'. When this maximum is reached, the strategy switches to sell mode only.

The trading limit multiplier impacts how quickly this maximum is reached by increasing the investment amount per buy order.
Min volume to sellMIN_VOLUME_TO_SELL10Defines the minimum notional value of orders that can be sold, helping to manage and avoid balances too small to be traded effectively. Verify the actual minimum order value on your exchange, as this default value is just an estimation.
Max invested baseMAX_INVESTMENT999999999999999Cap on the total investment in the base currency, ensuring you do not exceed your investment budget. For example, setting this to 1000 USDT on a USDT-BTC pair limits your total investment to 1000 USDT.
Funds reserveFUNDS_RESERVE0The amount of base currency reserved and not used in trading. Ensures that trading ceases if your available funds fall below this threshold, safeguarding essential capital.

Customize targets

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15Selects the candle period for calculating auto step size and trailing ranges. A lower period increases trading frequency and associated risks, making it crucial to choose a period that aligns with your trading style and risk tolerance.
Auto gainAUTO_GAINtrueEnables dynamic profit targeting based on the market's support and resistance levels. This feature adjusts the profit target as the position size increases, ensuring it does not fall below twice the trading fees. It overrides any manually set profit targets.
GainGAIN0.5Set a fixed profit target as a percentage above the break-even price. For instance, setting this to 0.5% means that a sell order is placed whenever the price reaches 0.5% above the cost price.

This parameter is particularly useful when you wish to lock in profits at a consistent percentage.
Grid multiplierGRID_MULTIPLIER1Adjusts the spacing between buy orders relative to pre-set levels. For example, a value of 1.5 increases the distance between orders by 1.5 times, while a value of 0.5 reduces it by half.

This setting can be tuned to match market volatility and your trading strategy.
Trailing range multiplierTRAILING_MULTIPLIER1Modifies the trailing range for orders. A multiplier of 1 uses the standard range, while 1.5 increases it by 50%, and 0.5 decreases it by 50%.

Adjust this setting to enhance or reduce the responsiveness of your strategy to price movements.
Unit costunit_costtrueDetermines how the break-even price is calculated:

- Enabled: The break-even price represents the average cost per unit of the remaining balance.
- Disabled: The break-even line indicates the price at which all remaining units can be sold to break even on the total sequence of trades.

Choose based on whether you prefer to track average cost or total trade sequence profitability.

Trend options

LabelConfig ParameterDefault ValueDetailed Description
Trend openTREND_OPENfalseAllows opening of new positions only when the 4-hour and 15-minute charts both indicate a bullish market. This setting helps align your trading strategy with the overall market trend, potentially increasing its effectiveness.

Note: Requires that the exchange provides the necessary candle data.
Dynamic DCA blockTREND_BLOCK_DCAfalseRestricts Dollar-Cost Averaging (DCA) trades to periods when both the 4-hour and 15-minute charts show a bullish trend. This precaution helps avoid increasing positions during unfavorable market conditions.

Note: Requires that the exchange provides the necessary candle data.
Dynamic DCA distanceTREND_LOWER_DCAfalseDoubles the DCA distance when the market does not show a bullish trend on the 4-hour and/or 15-minute charts. This setting increases safety by preventing premature buys during downward trends.

Note: Requires that the exchange provides the necessary candle data.
Trend CT multiplierTREND_CT_MULTIPLIER2Adjusts the buy target distance during non-bullish trends when using Dynamic DCA distance. A value of 2 doubles the target distance, allowing for more conservative trading under uncertain market conditions.
Trend grid multiplierTREND_GRID_MULTIPLIER2Modifies the next DCA target distance during non-bullish trends when using Dynamic DCA distance. Doubling the distance with a value of 2 provides a cautious approach to additional buys in a potentially declining market.

Advanced

LabelConfig ParameterDefault ValueDetailed Description
Stop after next sellSTOP_AFTER_SELLfalseStops all trading activity after selling off the current holdings. This can be used to end trading temporarily without closing the bot, providing a natural pause after clearing the current position.
Buy enabledBUY_ENABLEDtrueAllows or disallows the placement of buy orders. Keeping this enabled typically results in better performance of the strategy as it allows for continuous operation and opportunity capture.
Sell enabledSELL_ENABLEDtrueEnables or disables the ability to place sell orders. Similar to buys, maintaining this setting enabled generally enhances the strategy's performance by ensuring liquidity and profit-taking opportunities are not missed.
CT TL limit multiplierCT_TL_MULTIPLIER0.5Sets the investment amount for continuous trading as a ratio of the last DCA buy. For instance, a setting of 0.5 uses half the base amount of the last DCA order for ongoing trading, which can be adjusted according to risk tolerance and market conditions.
Start CTSTART_CONT_TRADING3Defines the threshold at which continuous trading starts. A value of 3 means continuous trading begins once the position size reaches three times the trading limit, allowing for strategy adjustments based on the developed position size.
CT restart multiplierCT_RESTART_MULTIPLIER1Controls the re-entry point after a continuous trading sell. A multiplier of 1 places the buy target right above the last sell rate, facilitating re-entry at a similar market condition as the exit. Adjust this to manage re-entry risks and timing.
SMA periodSMAPERIOD50Determines the number of candles used for calculating support and resistance, which are critical for setting buydown targets and trailing ranges. The default of 50 is a balance suitable for various market conditions but can be adjusted for more or less sensitivity.
Keep quoteKEEP_QUOTE0Specifies a minimum amount of quote currency to keep and not sell. Setting this to 0.01 BTC on a USDT-BTC pair ensures that the last 0.01 BTC is not sold, maintaining a small position in the market irrespective of other operations.
Ignore trades beforeIGNORE_TRADES_BEFORE0Allows you to disregard any trades before a specified timestamp, useful for resetting strategy calculations or avoiding outdated data. Enter the timestamp in milliseconds, which you can generate at sites like currentmillis.com.
tip

Other parameters

Watch mode is respected.

Besides settings mentioned on this page, no other strategy setting has any effect on spotgridadvanced.