---
id: spread-strategy-and-its-parameters
title: "Spread Strategy and Its Parameters"
section: documentation
category: "Strategies / Advanced Strategy Parameters"
url: https://moonbot.pro/documentation/advanced-strategy-parameters/spread-strategy-and-its-parameters
locale: en
status: published
updated_at: 2026-08-31T19:38:53+00:00
---

# Spread Strategy and Its Parameters

To make the Spread strategy appear in the list of strategies in the Moonbot terminal, you must activate the paid Autotrading extension package.

⚠️ Attention! The Spread strategy is associated with very high risks. Use it without auto-buy, as a detection tool, to understand how it works. Only after fully understanding it should you configure it for real trading.Example of the Spread strategy operation during the listing of the DODO coin:

![An example of how the Spread strategy works during the DODO token listing](https://moonbot.pro/storage/editor-images/%D0%A1%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F%20Spread_1.png)

![An example of how the Spread strategy works during the DODO token listing (dark)](https://moonbot.pro/storage/editor-images/%D0%A1%D1%82%D1%80%D0%B0%D1%82%D0%B5%D0%B3%D0%B8%D1%8F%20Spread_1.png)

By spread we mean active trading within the zone between the ASK and BID boundaries, defined by time and price range.

### General Parameters

- TimeInterval: field for specifying the time interval in fractions of a second over which the calculation is performed (from 0.5 to 30 seconds, the default is 5);
- TradesDensity: field for specifying trade density over time, it is specified in whole percentages from 10 to 100, by default 80. To calculate trade density, the TimeInterval is divided into small 100 ms segments (baskets), and the ratio between segments containing at least 2 trades with different prices and “empty” segments (without trades) is calculated. For example, TradesDensity = 100 (%) means that trades with different prices occur at least every 100 ms;
- TradesDensityPrev: field for specifying trade density before detection, calculated over the previous interval equal to TimeInterval. A positive integer from 0 to 100, 20 by default, if 0, then the parameter is not used. This helps filter out coins that were initially inactive. For pump scenarios, this parameter should be set to 0, since inactive coins (with low volatility before the spread appears) are required;
- TradesCountMin: field for specifying the minimum number of trades every 100 ms throughout the entire detection interval. A positive integer starting from 0 and without an upper limit, by default 0. If 0, not applied. A high value may significantly limit detections, as it will select only environments with very high trade density;
- PriceIntervals: field for specifying the number of equal segments into which TimeInterval is divided to calculate the price range. A positive integer from 1 to 100, by default 10. TimeInterval is divided into PriceIntervals parts; for each part, the maximum and minimum price and the delta (difference) between them are calculated;
- PriceIntervalShift: field for specifying a positive integer from 0 to 5. This setting cuts off the detectors from a single arrow that hits the boundary of the piece being measured. Calculation principle: the analysis interval is shifted to the left by 100 ms, PriceIntervalShift times. Each time, detection conditions are recalculated for the shifted interval. The final detection will trigger only if conditions are met on all shifted intervals. If 0, recalculation is not performed;
- PriceSpread: field for specifying the minimum percentage spread for the detector. A positive fractional number starting from 0.01 and without an upper limit, 0.3 by default. Detection occurs if, in each part of PriceIntervals, the price range exceeds PriceSpread. If the Spread strategy has modifiers enabled, then the threshold increases dynamically in terms of volatility. The total range should be wider than three steps of the exchange's price - there will be no detection on coins with a rough step;
- PriceSpreadMax: field for specifying the maximum total range for the entire calculation window. A positive integer starting from 0 and without an upper limit, the default is 0. If 0, not applied;
- IntervalsForBuySpread: field for specifying the number of recent segments from PriceIntervals for calculating the minimum and maximum price boundaries of the spread corridor, from which entry and exit prices are calculated. A positive integer from 0 to 10, the default is 3. If 0, calculation is performed over the entire TimeInterval;
- BuyPriceInSpread: field for specifying the percentage at which to place the Buy order within the spread. An unlimited positive or negative integer, default is 20. For long positions, the percentage is measured upward from the minimum price; for short positions, downward from the maximum price.Examples
  - If BuyPriceInSpread = 0 (%), the long Buy order will be placed at the minimum price within the spread;
  - If BuyPriceInSpread = 50 (%), the long Buy order will be placed in the middle of the spread;
  - If BuyPriceInSpread = -100 (%), the short Buy order will be placed above by double the spread distance;Please note! The buyPrice parameter from the Buy conditions tab also affects the purchase price. In this case, BuyPriceInSpread defines the “base price,” from which buyPrice is then calculated. And each repeat order reduces the value by 4 (at least 0), that is, the repeat goes deeper into the corridor.
- SellPriceInSpread: field for specifying the percentage at which to place the Sell order within the spread. An unlimited positive or negative integer, default is 80. Similar to BuyPriceInSpread, but defines the preset selling price based on the spread. Unlike BuyPriceInSpread, the selling price is taken as the higher of either SellPrice or the spread-based price. In other words, if SellPrice is smaller than the spread value, for example SellPrice = 0, then the sale is placed based on the spread. If greater, the sale is placed based on SellPrice. Modifiers also affect the selling price;
- BuyOrderReduce: field for specifying the interval in milliseconds over which the average trading volume is calculated. The strategy will place an order no larger than the average volume. A positive integer from 0 to the timeInterval×1000 value, for example, if timeInterval=5 ms, then the maximum value will be BuyOrderReduce = 5x1000 = 5000 ms, by default 100 ms. If 0, not applied;Volume is calculated as follows: the total volume of all buy and sell trades (BV + SV) over the TimeInterval is summed and divided by BuyOrderReduce. For example, if TimeInterval = 5 (seconds), i.e., 5000 ms, BuyOrderReduce = 100 (ms), and the total trade volume over 5 seconds was $10,000, then the average volume per 100 ms equals 10000 / 5000 ms * 100 ms = $200. In this case, the strategy will place a Buy order no larger than $200.In other words, we calculate the average volume over 100 ms / 10 ms / 5 ms — this becomes the maximum order size the strategy will place.The order size reduction function can be seen in the log with an entry such as:IOTA: [1] (40) Buy order reduced: 1000.00$ => 23$ (Vol: 23$)In this log, OrderSize in the strategy was set to $1000, but the average trading volume over 100 ms was only $23, so the strategy placed a Buy order of $23.The order reduction mechanism does not allow its reduction below the minimum order size on the exchange.
- MinReducedSize: field for specifying the minimum Buy order size in USDT after applying the BuyOrderReduce parameter, below which the Buy order will not be placed. A fractional positive number, starting from 0 and without an upper limit, by default 0. If 0, not applied.The parameter only works when BuyOrderReduce is greater than zero, and this is the earliest cutoff - before checking the density and spread size.For example, if MinReducedSize = 50 (USDT) and after applying BuyOrderReduce it is calculated that only a $23 Buy order can be placed, then since $23 is less than $50, the $23 Buy order will not be placed, and the log will contain the entry "Reduced order would be too small".
- SpreadRepeatIfProfit: field for specifying the relative percentage from the buy price to the sell price at which the strategy is allowed to place a repeated Buy order in the first ~2 seconds after detection (no later). That is, a repeated Buy order can be placed if the current price has risen and becomes higher than the buy price by SpreadRepeatIfProfit percent toward the sell price, and this occurs within ~2 seconds after the detection. If 0, repeated orders are not placed.For example, if SpreadRepeatIfProfit = 100 (%), the current price must reach the Sell order price and the position must be sold, after which the strategy is allowed to place a repeated Buy order.If SpreadRepeatIfProfit = 50 (%), the current price must reach half the distance between the buy price and the Sell order price, and then the strategy will be allowed to place a repeated Buy order. No more than 5 repeated Buy orders are allowed in the Spread strategy due to an internal code limitation.
- SpreadFlat: YES/NO checkbox. If YES (by default), then the strategy will try to determine the spread in the horizontal channel: the fresh average price is inside the boundaries of the oldest piece, and each piece overlaps with the old one by at least 75% of the corridor width, the same check is performed with respect to the penultimate piece. This is the protection against working in an inclined channel, which formally gives the desired scope;
- Spread_BV_SV_Time: field for specifying the interval in milliseconds for measuring the Buy volume (BV: BuyVolume) and Sell volume (SV: SellVolume). A positive integer from 0 to 30000 ms, 3000 by default. If 0, it is not applied and disables the entire bundle of BV_SV parameters in this strategy;
- Spread_BV_SV_Max: field for specifying the maximum ratio of Buy volume (BV) to Sell volume (SV). A fractional positive number from 0 to 100 (you can enter a larger number, but this is the actual maximum value), by default 0. If 0 is set, not applied.
- Spread_BV_SV_Min: field for specifying the minimum ratio of Buy volume (BV) to Sell volume (SV). A fractional positive number from 0 to 100 (you can enter a larger number, but this is the actual maximum value), by default 0. If 0 is set, not applied.If there is a short in the strategy, the ratio is flipped automatically, that is, the ratio of sales volume (SV) to purchases volume (BV) is considered for the short.Example: Spread_BV_SV_Time = 1500 ms.Over the last 1500 ms there were Buy trades totaling $500 and Sell trades totaling $1000.The BV/SV ratio will be 500/1000 = 0.5 for long, or 1000/500 = 2 for short, respectively.
- SpreadPolarityMin: field for specifying the minimum boundary of the spread's polarity corridor. An integer from -100 to 100, the default is -100.
- SpreadPolarityMax: field for specifying the maximum limit of the spread's polarity corridor. An integer from -100 to 100, by default 100.The polarity of the spread shows which edge of the corridor the price is pressing against relative to the moving average: if "-100", then the shots are only down, if "100", then the shots are only up, fresh small pieces (baskets) of 100ms weigh more. Attention! The maximum is calculated based on the last 5 seconds, even if the window is wider.

### Example of a Spread strategy

TimeInterval = 5 (sec.) TradesDensity = 100 PriceIntervals = 5 PriceSpread = 0.3 (%) IntervalsForBuySpread = 2 BuyPriceInSpread = 5 (%) SellPriceInSpread = 100 (%) BuyOrderReduce = 100 (ms)

With these parameters, over the last 5 seconds, each second must have a price fluctuation greater than 0.3%. For calculating Buy and Sell orders, the last 2 intervals will be used (IntervalsForBuySpread = 2). The Buy order will be placed at a relative +5% from the minimum spread value, and the Sell order at a relative +100%, i.e., at the spread maximum.

At the same time, if the reduced volume per 100 ms is smaller than the Buy order size specified in the strategy OrderSize parameter, the Buy order will be placed equal to this reduced volume per 100 ms.

1. It is VERY important to use Latency filters in the Spread strategy, since price values for spread detection are taken from trades (crosses on the chart). If prices arrive with delay, detection may trigger when the price has already risen sharply!
2. If the Buy order is partially filled, the strategy cancels it and places the entire executed volume for sale, similar to the MoonShot strategy.
3. Detection conditions are recalculated once every half second.
4. The strategy accounts for detection modifiers (the modifier affects PriceSpread).
5. It is recommended to use this strategy with a short EMA filter, for example EMA(30,2), to determine price rise or fall and place a high Sell order for short or long respectively.
6. If multiple Spread strategies are enabled in the Moonbot terminal, detections and order placement will occur for each of them, since the Spread strategy always has IndependentSignals = YES enabled on the Main tab. At the same time, an information line with the values at the time of detection will be displayed above the graph after detection from the Spread strategy.
7. Also, the values of the Spread strategy parameters can be observed in the upper part of the coin chart on which it worked. To do this, enable the Extended Debug Mode checkbox on the Settings → Advanced → System tab.

![Spread Strategy](https://moonbot.pro/storage/editor-images/Spread_Strategy1_W.jpg)

![Spread Strategy (dark)](https://moonbot.pro/storage/editor-images/Spread_Strategy1_B.jpg)

These values are also shown in the detection line in the report:

![Spread Strategy2 W eng](https://moonbot.pro/storage/editor-images/Spread_Strategy2_W-eng.jpg)

![Spread Strategy2 W eng (dark)](https://moonbot.pro/storage/editor-images/Spread_Strategy2_B-eng.jpg)

8. Additionally, you can configure sending messages about the Spread strategy to Telegram and receive messages of this type there:

Signal (strategy ) coin: #KNTQ SpreadDetection: Spread: TD: 10% TD2: 2% dP: 1.9% Vol: 1.7 k Trades: 2 Spread: 1.9% N: 2 (K2: +64.1) bv/sv: 4.19

TD: trade density as a percentage (TradesDensity)

TD2: trade density before detection as a percentage (TradesDensityPrev)

dP: price range over the entire timeInterval interval as a percentage

Vol: the average volume calculated using the BuyOrderReduce parameter in the currency of the pair

Trades: number of trades (TradesCountMin)

Spread: the minimum spread in pieces, in percent (PriceSpread)

N: the number of pieces on which the spread is detected, the last two appear on the chart only at the time of detection (PriceIntervals)

K2: the polarity (direction) of the spread, lies in the range from +100 to -100 (SpreadPolarity)

bv/sv: ratio of BuyVolume purchase volume to SellVolume sales volume (Spread_BV_SV)
