Sgsfutures
A futures grid strategy that's almost exactly like the spot stepgridscalp strategy. The main difference is that it does not (small stop losses aside) partially close trades at prices worse than avg. entry price. Default settings differ from spot, and ensure a higher trading frequency.
This strategy runs in long only mode.
Key features:
- truly multi timeframe: user configurable low, medium und high timeframes for monitoring aspects like trend changes, momentum strength and more. For example you could trade on 5m charts, while also monitoring 15m and 4h.
- different trading styles that are automatically used when opportune:
- normal grid trading
- cautious 'scalping' in upper ranges: aiming to exit the zone with no or a very small sized bag, using a smaller amount per buy order, strict buydowns for DCA and very cautious sell trailing
- trade supports: when the market looks very bad, grid buy trading stops and the strategy moves into a mode where it trades higher timeframe supports with limit orders
- different sell trailing styles that are automatically used when opportune:
- regular trailing, with dynamic trailing ranges
- candle low trailing, to trail bigger moves upwards
- micro stop loss style, to quickly start sell trailing after riskier buy orders, accepting a tiny loss as outcome
- quick detection of trend direction changes
Cancel orders must be disabled in the global bot settings when you use the 'trade supports' option (you can do that on the setup page).
About the trend module
The trend options are what set this strategy apart from other similar strategies. The exact details are not public to protect the work of the author, but how the data is used is a lot simpler and more transparent than in previous strategies that use black box data.
All data mentioned below, is visible in the right sidebar on the chart page
Phase system
Using data from three configurable timeframes, one out of six phases gets recognized at any time:
1: very bearish 2: bullish reversal 3: bullish 4: very bullish 5: bearish reversal 6: bearish
Trend sync uses the phase system to determine if any of the following is allowed:
- opening new trades, coming from a situation where there is no balance to sell
- grid trading
- pausing grid trading, and placing limit orders at higher timeframe supports
Trend plus uses the phase system to apply dynamic trailing ranges, for example by increasing the sell trailing range in a very bullish market.
Trend scalping uses the phase system to go into 'scalping mode' when the market is either bullish, or very bullish. This mode using a more careful sell trailing mechanism (including tiny, partial stop losses), and reduces the number of 'high' buy orders, and instead buying more when price is slightly moving down again.
All trend options can be used together, or individually.
Overbought status and momentum
By monitoring higher timeframes to determine if (and how much) the market is overbought and if the current momentum is bullish or bearish, the strategy can be either more careful with new trades, or extend trailing ranges to aim for more profit.
The strict entry and strict dca options depend heavily on longer term momentum status.
Overview of restrictions
This strategy offers several settings that put restrictions on when new trades may be opened and when DCA is allowed, most of these settings can be used together.
When all restrictions are disabled, the strategy behaves like a more configurable version of stepgrid with small hardcoded limits on repeated buy orders in the same price zone, with much better sell trailing.
The overview below describes the main impact of each restrictive setting.
Setting | Restrictions on new trades | Restrictions on any buy order |
---|---|---|
Price action analysis |
|
|
Strict entry |
|
|
Strict DCA |
|
|
Exhaustion sensitivity |
|
|
Trade supports |
|
|
Trend scalping |
|
|
Custom trading range |
|
|
SgsFutures settings
Balance settings
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Trading limit | TRADING_LIMIT | 40 | The base amount you use for each regular buy order in contracts on coin-m markets. This amount also calculates the 'buy count'. |
Trading limit multiplier | TL_MULTIPLIER | 1 | This setting allows you to modify the invested amount for each consecutive buy order. For example, with a trading limit of 100 USDT and a maximum buy count of 3: - 1: each buy order is for 100 USDT - 1.5: first buy 100, second buy 150, third buy 225 - 2: first buy 100, second buy 200, third buy 400 The range for this setting is between 1 and 5. |
Always use TL multiplier | ALWAYS_USE_TL_MULTIPLIER | false | This setting controls whether the 'TL ratio' settings use an absolute amount as input or the multiplier trading limit amount. - Enabled: All TL ratio settings use the TL multiplier for the base amount to apply the ratio on. - Disabled: Each TL ratio setting works as 'absolute amount set as trading limit' multiplied by the ratio. |
Max buy count | MAX_BUY_COUNT | 20 | Limits the maximum position size, applying to all order triggers except BTFD mode. The use of the trading limit multiplier is considered, factoring in the increased investment per buy order into the 'buy count' so that each DCA round is counted once. For example, a value of 40 means the total position size may not exceed 40 times the amount set as 'trading limit'. When the maximum is reached, the strategy switches to sell mode only. |
Max open contracts | MAX_OPEN_CONTRACTS | 999 | This setting specifies the maximum size of a futures position in quote units. If executing a subsequent order would exceed the maximum open contracts, the order will not be executed. |
Max loss | MAX_LOSS | 999999999999999 | Sets the maximum acceptable loss. If the unrealized loss exceeds this max loss, the strategy will close the full position at a loss. For example, if the max loss is set to 100, a stop loss will occur when the unrealized PnL exceeds -100. |
Profit settings
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Gain | GAIN | 2 | Specifies the minimum gain percentage necessary for a full close of the position. For instance, setting this to 1 means a full sell is only permissible when the price hits a sell step at least 1% 'above' the average entry price. |
Partial sell gain | GAIN_PARTIAL | 0.3 | Sets the minimum gain target for partial close orders. For example, setting this to 0.5 means that partial sell orders occur when the price reaches at least 0.5% above the average entry price and continues up to the gain target for a full close. |
Partial sell ratio | PARTIAL_SELL_RATIO | 0.3 | Determines the portion of the position size used for each partial close order. Setting this to 0.3 means that each partial close order will use 30% of the position size. |
Use partial sell cap | PARTIAL_SELL_CAP | true | Enables an upper limit to the quantity of partial close orders. |
Partial sell cap ratio | PARTIAL_SELL_CAP_RATIO | 2 | Sets the maximum value for partial close orders. For instance, setting this to 2 means a partial close order may not exceed twice the 'trading limit'. |
Period settings
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Period | PERIOD | 5 | Selects the trading timeframe to use for short-term market data analysis. |
Period medium | PERIOD_MEDIUM | 15 | Selects the trading timeframe to use for medium-term market data analysis. |
Period long | PERIOD_LONG | 60 | Selects the trading timeframe to use for long-term market data analysis. |
Customize grid
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Auto step size | AUTO_STEP_SIZE | candleSize | Lets the bot automatically determine a grid step size that fits the pair's current volatility. Available options are 'none', 'ATR', and 'candleSize'. If set to 'none', the configured absolute or percentage step size is used instead. |
Minimum step pct | MIN_STEP_PCT | 0.3 | Sets the minimum percentage size for steps, to overrule automatic step size. A setting of 0.3 means that the absolute minimum for auto step size is 0.3% of the current price. |
Step size | STEP_SIZE | 500 | Manually defines the grid step size for buy and sell orders when auto step size is not enabled. Set as a price: setting 500 on USDT-BTC makes the bot trade each time price moves 500 USDT. When using Pct step size, the value represents a percentage: setting 2 will lead to having steps of 2% of the current price. |
Pct step size | PCT_STEP_SIZE | false | When enabled, the value for step size represents a percentage. |
Enforce step size | ENFORCE_STEP | false | Used to ensure step size is respected. Price trailing can sometimes finish at a rate worse than the current grid step up or down. With this option enabled, orders may only get fired when trailing finishes at a better rate than the current step target. This can be useful for very precise balance management. |
Direction | DIRECTION | LONG | This setting controls the direction the strategy trades. Available option is 'LONG', indicating trading only long positions. |
Use market orders | MARKET_ORDERS | true | Controls whether grid orders are placed as market orders or not. Generally, enable this for most exchanges but disable for dYdX. When disabled, grid orders are placed as limit orders when price trailing finishes (note that these are not post-only orders, they are meant to fill immediately). |
Customize trailing
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Pct buy trailing range | PCT_TRAILING_RANGE | false | By default, buy trailing ranges are set automatically based on the current distance between support and resistance. With this option, you can set a percentage as a custom trailing range to be used for buy and sell trailing. |
Custom buy trailing range | CUSTOM_TRAILING_RANGE | 0.3 | When pct buy trailing range is enabled, setting 0.5 will lead to having buy trailing ranges of 0.5% of the current price. |
Pct sell trailing range | PCT_SELL_TRAILING_RANGE | false | By default, sell trailing ranges are set automatically based on the current distance between support and resistance. With this option, you can set a percentage as a custom trailing range to be used for buy and sell trailing. |
Custom sell trailing range | CUSTOM_SELL_TRAILING_RANGE | 0.3 | When pct sell trailing range is enabled, setting 0.5 will lead to having sell trailing ranges of 0.5% of the current price. |
IRIS-Trend | Price action
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Price action analysis | TREND_SYNC | false | When enabled, trend data of the configured timeframes for short, medium, and long term is used to follow price action to: - (dis)allow opening new trades - switch between normal grid trailing and grid trailing with increased trailing ranges. |
Price action TL ratio | PRICE_ACTION_TL_RATIO | 1 | Can be used to modify buy amounts when price action is very positive. Setting 2 places buy orders for 'trading limit' * 2. |
Price action threshold | PRICE_ACTION_THRESHOLD | 0 | ATR percentage rank threshold used in the conditions to allow 'price action tl multiplier' and 'Price action analysis (during phase bullish reversal)'. Setting 0.5 means that the current medium period ATR percentage rank value must be at least 50% and the current candle is green. |
Strict entry | STRICT_ENTRY | false | When enabled, more conservative criteria are used to (dis)allow opening new trades, mainly by not buying into overbought market conditions. This can lead to times of inactivity after a final sell, by design. |
Strict DCA | STRICT_DCA | false | When enabled, grid DCA trades are not allowed when the upper timeframe has bearish momentum. |
Exhaustion sensitivity | EXHAUSTION_SENSITIVITY | MEDIUM | This setting controls up to which timeframe exhaustion must pass before a next DCA buy is allowed. - NONE: disables this protection - SHORT: do not allow buy orders when short term is exhausted - MEDIUM: do not allow buy orders when short OR medium term is exhausted - LONG: do not allow buy orders when short OR medium OR long term is exhausted |
IRIS-Trend | Trade supports
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Trade supports | TRADE_SUPPORTS | true | When enabled, trend data of the configured timeframes for short, medium, and long term is used to follow price action to a mode in which limit orders targets are placed at medium or long term support levels. |
S1 TL ratio | SUPPORT_TL_RATIO | 2 | When trend sync is enabled and multiple timeframes move downwards, limit buy targets are placed at medium or high timeframe supports. This setting determines the buy order value for S1 targets, it multiplies 'trailing limit'. Setting 2 places buy orders for 'trading limit' * 2. |
S2 TL ratio | SUPPORT2_TL_RATIO | 2 | When trend sync is enabled and multiple timeframes move downwards, limit buy targets are placed at medium or high timeframe supports. This setting determines the buy order value for S2 targets, it multiplies 'trailing limit'. Setting 2 places buy orders for 'trading limit' * 2. |
IRIS-Trend | Micro scalping
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Micro scalping | TREND_SCALPING | true | When enabled, trend data using the configured timeframes for short, medium, and long term is used to: - (dis)allow opening new trades - switch between normal grid trading and micro scalping During micro scalping, partial stop loss orders are possible. |
Micro scalp TL ratio | SCALP_TL_RATIO | 0.625 | When trend scalping is enabled and a scalping zone is reached, buy and sell amounts are based on this ratio. This setting determines the buy order value for support targets, it multiplies 'trailing limit'. Setting 0.5 places buy orders for 'trading limit' * 0.5. |
Initial buy step multiplier | SCALP_INIT_BUY_MULTIPLIER | 0.6 | Can be used to modify the first buy step size, when not in a position and the strategy is in status 'scalping'. Lower values lead to opening a new trade quicker. This multiplier is used like 'multiplier * step size', where step size can be an automatically generated value, or a defined manual step size. |
Dynamic stop loss | DYNAMIC_SL | false | This is a stop loss option for small positions (up to 2x 'trading limit', rounded), accumulated in higher regions. The goal is to accept a relatively small loss sometimes, before a trade gets hard to DCA effectively. |
IRIS-Trend | Multiple timeframes
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Multi timeframes mode | MULTIPLE_TIMEFRAMES_MODE | false | When enabled, the strategy switches to a lower set of timeframes when it detects favorable conditions during a 'bullish reversal' phase, with the aim of reaching a higher trading frequency. When the lower set of timeframes all have exhausted market conditions, it switches back to the regular set of timeframes. |
Multi timeframes mode TL ratio | MTF_TL_RATIO | 1 | Trading limit ratio to use for buy trading using the lower set of timeframes. This setting determines the buy order value for support targets, it multiplies 'trailing limit'. Setting 0.5 places buy orders for 'trading limit' * 0.5. |
Lower set low period | LOWER_PERIOD_LOW | 5 | Low period of lower set of timeframes. |
Lower set medium period | LOWER_PERIOD_MEDIUM | 15 | Medium period of lower set of timeframes. |
Lower set high period | LOWER_PERIOD_HIGH | 30 | High period of lower set of timeframes. |
Regular set low period | MIDDLE_PERIOD_LOW | 15 | Low period of regular set of timeframes. Should normally be set identically to the period settings in the indicator section. |
Regular set medium period | MIDDLE_PERIOD_MEDIUM | 60 | Medium period of regular set of timeframes. Should normally be set identically to the period settings in the indicator section. |
Regular set high period | MIDDLE_PERIOD_HIGH | 240 | High period of regular set of timeframes. Should normally be set identically to the period settings in the indicator section. |
IRIS-Trend | Accumulation cycle
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Accumulation cycle | ACCUMULATION_CYCLE | false | When enabled, no partial sells 'below' avg entry are allowed, full sell only allowed when gain target is reached and the market is exhausted on the upper timeframe. New trades are only opened during the 'bullish reversal' phase. Micro scalping is disabled. |
IRIS-Trend | Advanced trailing
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Advanced trailing | TREND_PLUS | true | When enabled, trend data using the configured timeframes for short, medium, and long term is used to in- and decrease trailing ranges based on the currently detected market phase. This overrules a trailing modifier in 'strict price action'. |
Buy multiplier small | TREND_PLUS_BUY_MULTIPLIER_SMALL | 1 | Smallest buy trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
Buy multiplier medium | TREND_PLUS_BUY_MULTIPLIER_MEDIUM | 2 | Medium buy trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
Buy multiplier large | TREND_PLUS_BUY_MULTIPLIER_LARGE | 5 | Largest buy trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
Sell multiplier small | TREND_PLUS_SELL_MULTIPLIER_SMALL | 0.5 | Smallest sell trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
Sell multiplier medium | TREND_PLUS_SELL_MULTIPLIER_MEDIUM | 2 | Medium sell trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
Sell multiplier large | TREND_PLUS_SELL_MULTIPLIER_LARGE | 5 | Largest sell trailing range multiplier. Multiplies the currently active trailing range: auto or custom pct. 1x auto trailing range equals 0.2x ATR. |
IRIS-Trend | BTFD mode
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
BTFD mode | BTFD_MODE | false | When enabled, a configurable series of limit buy orders gets placed when price drops below a defined or automatic price target and there are no open orders at that time. |
BTFD use trend filter | BTFD_TREND_FILTER | false | When enabled, the trend module only allows to BTFD when the market is confirmed very bearish, sell volume is leading on the upper timeframe and volatility is high. Can be used together with manual or automatic price targets. |
BTFD dip target | BTFD_DIP_TARGET | 0 | Manual price target to start BTFD mode. As soon as price drops below this target and there are no open orders, a series of limit buy orders get placed. Normal grid buy operations stop below this price. |
BTFD max dip target | BTFD_MAX_DIP_TARGET | 0 | Manual price target to stop BTFD mode. No limit buys get placed below this target. Example: dip target set to 1000, max dip target set to 900, means that BTFD may only buy between 1000 and 900. |
BTFD use automatic targets | BTFD_AUTO_TARGET | none | Enable to use automatic dip targets. Conditions to BTDF with auto targets: price drops below selected target and there are no open orders. When used together with the 'trade supports' option, BTFD would not activate if there are support orders open already. When combined with 'trade supports', it is strongly recommended to select long term S2 or a manually set target. |
BTFD TL ratio | BTFD_TL_RATIO | 1 | Can be used to modify buy amounts during BTFD. Setting 2 places buy orders for 'trading limit' * 2. |
BTFD max buy count | BTFD_MAX_BUY_COUNT | 25 | Limits maximum position size during BTFD mode. When trading limit multiplier is used, the increased investment per buy order is factored into 'buy count' so each DCA round is only counted once. A value of 40 means that the total position size may not exceed 40x the amount set as 'trading limit'. When max is reached, the strategy goes in sell mode only. |
BTFD max dip orders | BTFD_MAX_ORDERS | 5 | Max number of buy orders to fire, each placed at one step distance from another, to place when BTFD mode starts. Intended to limit the number of orders per time that BTFD activates, not to cap position size itself. Takes max buy count and max dip target into account, and stops placing lower orders when either of those would get exceeded. |
BTFD gain | BTFD_GAIN | 1 | Percentage above avg entry price, to place the sell target after a BTFD order. |
BTFD auto step size | BTFD_AUTO_STEP_SIZE | ATR | Lets the bot automatically determine a grid step size for BTFD that fits the pairs current volatility. When set to none, the configured absolute or percentage step size is used instead. |
BTFD step size | BTFD_STEP_SIZE | 500 | Manually defined grid step size for BTFD buy orders, when auto step size is not enabled. Set as a price: setting 500 on USDT-BTC makes the bot trade each time price moves 500 USDT. When using Pct step size, the value represents a percentage: setting 2 will lead to having steps of 2% of the current price. |
BTFD pct step size | BTFD_PCT_STEP_SIZE | false | When enabled, the value for step size represents a percentage. |
Custom trading range
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Custom trading range | CUSTOM_TRADING_RANGE_MODE | false | With this mode you can define the price zone in which you want the strategy to operate, and optionally set a stop target. With the settings like in the defaults, new trades may only be opened when price is between 8000 and 10000. DCA trades can be placed at any price. In case price drops below 7000 all funds get sold. Set stop target to 0 to effectively disable it. |
Trading range low | TRADING_RANGE_LOW | 8000 | Lower limit of manual trading range. Applies to opening new trades. |
Trading range high | TRADING_RANGE_HIGH | 10000 | Upper limit of manual trading range. Applies to opening new trades. |
Trading range stop | TRADING_RANGE_STOP | 7000 | Stop loss target of manual trading range. |
Trading range DCA stop | TRADING_RANGE_DCA_STOP | 7500 | Lower limit for DCA orders. No additional DCA orders are placed below this price. |
Stop loss ratio | TRADING_RANGE_STOP_RATIO | 1 | Can be used for partial stop losses that are triggered by DCA stop target. Regardless of input, minimum SL size is capped to 1x trading limit. Setting 0.5 places stop for 'quote balance' * 0.5. Note that setting a value below 1 can lead to repeated stops. When the last order trigger is this kind of stop order, it won't trigger again until another strategy trigger happens after, like a grid buy order. |
Advanced
Label | Config Parameter | Default Value | Detailed Description |
---|---|---|---|
Buy enabled | BUY_ENABLED | true | Allows or disallows placing buy orders. Strategy performs better when trades are always allowed. |
Sell enabled | SELL_ENABLED | true | Allows or disallows placing sell orders. Strategy performs better when trades are always allowed. |
Stop after next sell | STOP_AFTER_SELL | false | Used to stop trading after the current holding has been completely sold. When enabled, no new buy trades are placed at times where there is no balance to sell anymore. |
ATR period | ATR_PERIOD | 50 | Number of candles used to calculate Average True Range, which is used to calculate auto step size and trailing ranges. Default value of 50 should usually not need tuning. |
Ignore trades before | IGNORE_TRADES_BEFORE | 0 | Optional parameter to force Gunbot to not consider any trades before the time set. Value represents a unix timestamp in milliseconds. Get a current timestamp on currentmillis.com |
Other parameters
Besides settings mentioned on this page, no other strategy setting has any effect on stepgridscalp.