Skip to main content

Spotgrid

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

The idea of this strategy is to always be in a position, use market orders only, average down when prices goes down, take profit when price exceeds break even. And do so with an absolute minimum number of settings.

tip

This strategy is a bit different than all other Gunbot strategies: there are just a handful configurable options and it's "always in position": instead of waiting for the perfect entry it is always looking for chances to average down.

If you want to customize settings a lot, this strategy is not for you.

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.

SpotGrid settings

Balance settings

LabelConfig ParameterDefault ValueDetailed Description
Trading limitTRADING_LIMIT20This setting defines the base amount of USDT to invest for each buy order in the USDT-BTC trading pair.

You can adjust this to match your trading strategy's capital allocation per transaction.
Max buy countMAX_BUY_COUNT40Specifies the maximum number of positions you can open before the strategy switches to sell-only mode. This limit is a multiple of the 'Trading limit', with the default maximum allowing for up to 40 positions.

Once this limit is reached, no further buy orders will be placed until some positions are sold.
Min volume to sellMIN_VOLUME_TO_SELL10Defines the minimum order value in USDT that you can sell, preventing sales of negligible amounts. Ensure this setting aligns with your exchange's minimum order requirements.
Max invested baseMAX_INVESTMENT999999999999999Limits the total investment in USDT for the USDT-BTC pair to prevent overexposure. Adjust this value based on your overall trading capital and risk management strategy.

Customize targets

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15Chooses the time period of candles for calculating auto steps and trailing ranges. A shorter period increases trading frequency and potentially raises risk, affecting how dynamically your strategy reacts to price changes.
Auto gainAUTO_GAINTrueEnables a dynamic profit target based on the distance between support and resistance levels, ensuring a minimum profit of twice the trading fees. This setting automatically adjusts as your position size increases and supersedes any set manual target.
GainGAIN0.5Sets a fixed profit target as a percentage above your break-even price. With a default setting of 0.5%, a sell order is placed each time the price exceeds this threshold, ensuring consistent profit realization.
Grid multiplierGRID_MULTIPLIER1Adjusts the spacing between your buy orders. The default value of 1 uses predefined levels, while setting it higher increases the spacing (e.g., 1.5 increases it by 50%), and a lower value decreases the spacing, allowing for finer control over order placement.

Advanced

LabelConfig ParameterDefault ValueDetailed Description
Stop after next sellSTOP_AFTER_SELLFalseThis setting allows you to stop trading entirely once all current holdings are sold. Enabling this can be useful for strategies where you wish to pause operations after liquidating positions.
Buy enabledBUY_ENABLEDTrueControls whether buy orders can be placed. With this enabled, the strategy can continue to perform at its best by taking advantage of market opportunities as they arise.
Sell enabledSELL_ENABLEDTrueControls whether sell orders can be executed. Keeping this enabled ensures that you can always capitalize on profit-taking opportunities.
Unit costunit_costTrueDetermines if the break-even price is calculated based on the average cost per unit remaining or for the entire order sequence. This choice impacts how exit strategies are managed, especially when dynamic logic is not in use.
SMA periodSMAPERIOD50Defines the number of candles used to calculate support and resistance levels, which in turn helps determine buydown targets and trailing ranges. The default setting of 50 is a balanced choice for typical market conditions.
Keep quoteKEEP_QUOTE0Specifies a quantity of BTC (quote currency) to retain and not sell. Setting this to 0.01 BTC, for example, ensures that this small amount remains in your balance, unaffected by sell orders.
Ignore trades beforeIGNORE_TRADES_BEFORE0Allows you to set a timestamp (in milliseconds) before which all previous trades are ignored. Useful for restarting strategies without considering past performance.
tip

Other parameters

Watch mode is respected.

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