Skip to main content

Stepgrid

A grid like strategy that trades when price moves more than a defined step size. You can choose between using auto step size or setting a manual step size. Price trailing is completely automatic and happens every step up or down.

The idea of this strategy is to trade every meaningful price movement. Even while below the overall break even price of a position, it will still take advantage of small steps upwards to sell parts of a bag at rates profitable compared to their corresponding buy orders.

tip

This strategy is a bit different than most other Gunbot strategies: there are just a handful configurable options, confirming indicators are not a thing.

Trading behavior

When you run stepgrid with auto step size, this is the kind of trading behavior to expect:

Default stepgrid settings. Each arrow is an order: green = buy, orange = sell

Let's break down what actually happens:

  • Steps up and down are placed around last order rate, in case the trading pair has never traded before the reference price for steps is the price the pair had at the moment the strategy started running.
  • If price moves down a step, it automatically starts buy trailing and places a buy order for 1x 'trading limit' as soon as trailing finishes.
  • If price moves up a step while below break even, it automatically starts sell trailing and places a sell order when trailing finishes. Below break even each sell order is 1x 'trading limit' in size.
  • If price is above break even, the behavior is the same but the order quantities can exceed 1x 'trading limit. If price reaches a full step above break even, it will close a bag at once.
  • If price increases enough to reach the point where the next buy step is above break even, the buy step acts as stop in profit for positions bigger than 4x 'trading limit'.

When in no position, the bot will buy again when either the next buy or sell step is reached.

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.

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

The easiest way to start running stepgrid is by not owning any of the coins it is about to buy: starting with an existing balance is not recommended.

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.

How to create a stepgrid strategy

Using the advanced strategy editor: create a new strategy and select stepgrid as buy and sell method.

StepGrid settings

Balance settings

LabelConfig ParameterDefault ValueDetailed Description
Trading limitTRADING_LIMIT20The amount you can invest for each individual buy order.

This setting determines the base amount in USDT that will be used for each buy order in a pair like USDT-BTC.
Max buy countMAX_BUY_COUNT40Limits your maximum position size. When this maximum is reached, the strategy will only execute sell orders.

A maximum value of 40 means that the total position size cannot exceed 40 times the amount set as the 'Trading limit'. This helps in managing extensive buy positions and maintaining a balanced investment strategy.
Min volume to sellMIN_VOLUME_TO_SELL10Represents the minimum notional order value that must be met before executing a sell order. This setting is particularly useful for managing and avoiding the sales of insignificant or minimal balance amounts that might not meet the exchange's minimum order requirements.

Please check and verify this setting against the actual minimum order values set by your exchange.
Max invested baseMAX_INVESTMENT999999999999999This setting caps your total investment in the base currency, which in the case of USDT-BTC, limits the maximum amount of USDT you can invest.

This is crucial for risk management, ensuring that your investment does not exceed your intended allocation.

Customize grid

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15Selects the time period of the candles used to calculate the automatic step size and trailing range.

A lower period setting increases the frequency of trades but also enhances the associated risks by relying on shorter and possibly more volatile market snapshots.
Auto step sizeAUTO_STEP_SIZETrueAllows the bot to automatically determine the optimal grid step size based on the current volatility of the trading pair.

This automation is beneficial for adapting to changing market conditions without manually adjusting the step size.
Step sizeSTEP_SIZE500Manually sets the grid step size for buy and sell orders when the auto step size feature is disabled.

For example, setting a step size of 500 on USDT-BTC configures the bot to execute trades each time the price moves by 500 USDT, providing precise control over trade execution.
Enforce step sizeENFORCE_STEPFalseEnsures that the set grid step size is strictly adhered to during trading. This setting prevents the execution of orders at rates worse than the targeted grid step, thus promoting more consistent trade values and can help in maintaining precise balance management.
Unit costunit_costTrueDetermines the method for calculating the break-even price during your trading activities.

When enabled, the break-even price reflects the average cost per unit of the remaining balance. This can provide a more accurate reflection of your current position compared to a total sequence-based break-even calculation.

Advanced

LabelConfig ParameterDefault ValueDetailed Description
Stop after next sellSTOP_AFTER_SELLFalseEnables the strategy to cease trading after all current holdings have been sold.

This setting can be particularly useful in scenarios where you decide to take a break or reassess the market without initiating new buy orders. It ensures that no new positions are opened while allowing existing ones to close properly.
Forever bagsFOREVER_BAGSFalseActivates a strategy to capitalize on upward trends by ignoring the break-even price and placing each buy and sell order at the 'trading limit'.

This approach can maximize potential gains during bullish trends but does not utilize the 'max buy count' setting, emphasizing a consistent investment per trade.
Buy enabledBUY_ENABLEDTrueAllows you to enable or disable the placement of buy orders.

This control is essential for managing how the strategy interacts with the market, potentially restricting it to only sell operations depending on your strategic needs.
Sell enabledSELL_ENABLEDTrueAllows you to enable or disable the placement of sell orders.

This feature provides flexibility in strategy deployment, especially in varying market conditions where you might prefer to hold rather than sell.
Protect partial sellPROTECT_PARTIAL_SELLTruePrevents the execution of partial sell orders at unfavorable rates that do not cover the accumulated buy costs, potentially leading to a loss.

This safeguard relies on the bot having a complete transaction history, ensuring that all trades are accounted for in loss prevention calculations.
SMA periodSMAPERIOD50Defines the number of candles to calculate support and resistance levels, which are critical for determining trailing ranges.

The default setting of 50 candles balances responsiveness with stability, typically suitable for most trading scenarios without requiring adjustments.
ATR periodATR_PERIOD50Sets the number of candles used to calculate the Average True Range (ATR), a crucial metric for setting automatic grid steps based on market volatility.

Like the SMA period, a default value of 50 provides a good balance between market sensitivity and statistical reliability.
Keep quoteKEEP_QUOTE0Specifies the amount of quote currency to retain in your balance, not to be sold.

Setting this to 0.01 in a USDT-BTC scenario means that the last 0.01 BTC will always be kept in your balance, safeguarding a minimal quantity of the asset irrespective of trading conditions.
Ignore trades beforeIGNORE_TRADES_BEFORE0This setting allows you to specify a timestamp before which all previous trades should be disregarded by the strategy.

This can be crucial when starting fresh with a trading bot or after major changes to the strategy, ensuring that only relevant trades are considered for decision-making processes.
tip

Other parameters

Watch mode is respected.

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