Informational Notes
Cet article n’est pas disponible actuellement dans votre langue. L’utilisation d’un outil de traduction automatique est recommandée pour l’anglais.

How to Use the Trailing Up and Trailing Down Functions in USDⓈ-M Futures Grid Trading?

2024-03-05 02:59:05

Disclaimer: In compliance with MiCA requirements, unauthorized stablecoins are subject to certain restrictions for EEA users. For more information, please click here.

What are the trailing up and trailing down functions in USDⓈ-M Futures grid trading?

The trailing up function allows your USDⓈ-M Futures grid bot to adjust the trading range upwards to align with an upward-trend market, while the trailing down function moves the trading range downwards to align with a downward-trend market. These settings can address the limitations of traditional grid trading, where profits are often limited due to price breakthroughs.

When you enable the trailing up or down functions, your grid order’s upper and lower limits will automatically adjust as the asset's price rises or falls. This feature can potentially secure higher profits by taking advantage of price movements beyond the grid’s original range.

Note: To use the trailing down feature on the app, please upgrade to version 2.86.0 or above.

Only [Trailing Up] enabled

Only [Trailing Down] enabled

Both [Trailing Up] and [Trailing Down] enabled

Please note:

  • Once trailing up or trailing down is enabled, you cannot disable it during the current grid operation.
  • When only [Trailing Up] is enabled, the stop loss price for the long grid and the stop bottom price for the neutral grid will automatically trail up with the grid's lower price. These settings cannot be adjusted once set.
  • When only [Trailing Down] is enabled, the stop loss price for the short grid and the stop top price for the neutral grid will automatically trail down with the grid's lower price. These settings cannot be adjusted once set.
  • If both [Trailing Up] and [Trailing Down] are enabled at the same time, the stop trigger price of the USDT-Margined futures grid will not be trailed.
  • You are required to set a trailing up/down limit to enable these functions.

How to enable trailing up or trailing down?

1. You can activate trailing up or trailing down when placing a grid trading order. Simply check the box next to [Trailing Up] or [Trailing Down] to enable the feature.

2. Once [Trailing Up] is checked, you will need to set a trailing up limit price, which determines when the grid would stop moving up. The trailing up limit price should be higher than the Upper Price, and lower than the Trailing Cap Price and Stop Top Price for the neutral grid, Take Profit Price for the long grid, and Stop Loss Price for the short grid (if any).

Similarly, when [Trailing Down] is checked, you will need to set a trailing down limit price, which determines when the grid would stop moving down. The trailing down limit should be lower than the Lower Price when Trailing Down is enabled. The trailing down limit price should be higher than the Stop Bottom Price for the neutral grid, Stop Loss Price for the long grid, and Take Profit Price for the short grid (if any).

Based on your settings, you will see the corresponding trailing tag on the confirmation pop-up and order details page: [Trailing Up] if only trailing up is enabled, [Trailing Down] if only trailing down is enabled, and [Trailing] if both trailing up and trailing down are enabled.

How to monitor trailing orders?

You can monitor your trailing orders from [Running] and [History] tabs.

1. [Running]

  • You can view real-time data on all your active orders, including trailing up and trailing down orders. You may also adjust your order parameters here.
  • To view the grid parameters after each trailing, go to [Running /History Order Details] - [History] - [Trailing Records].

2. [History]

  • You can view a complete record of all your past orders. You may also check the performance of your completed trailing up and trailing down orders.

How to use the trailing functions in grid trading?

Let's use the below example to understand how trailing up and trailing down functions work in grid trading.

Parameters

  • Direction: Neutral
  • Lower limit price: $25,000
  • Upper limit price: $45,000
  • Trailing up limit: $54,000
  • Trailing down limit: $20,000
  • Number of grids: 5
  • Grid mode: Arithmetic
  • Leverage: 5x
  • Last price: $30,000
  • Min. quantity: 0.001
  • Min. notional: 5
  • Trailing coefficient: 2
  • Adjust coefficient: 0.95
  • Maximum price for this symbol: $4,529,764
  • Initial margin (set by the user): 500

Grid trading without using trailing up:

Initially, the bot will set up a grid trading structure with a buy order at the lower limit price ($25,000) and multiple sell orders from $33,000 to $45,000 evenly distributed across the grid based on the price gap.

PriceOrder
$45,000Sell
$41,000Sell
$37,000Sell
$33,000Sell
$29,000None
$25,000Buy

If the price rises above the upper limit price or falls below the lower limit price, the bot won’t place any new orders. It will wait for the price to drop and fulfill the existing buy orders to pair with the sell orders or wait for the price to rise and fulfill the existing sell orders to pair with the buy orders.

Grid trading using trailing up and trailing down:

  • Trailing up: Adjusts the trading range upwards in response to significant price increases.
  • Trailing down: Adjusts the trading range downwards in response to significant price decreases.

Example with trailing up:

If the price rises above the upper limit price and the price difference between the grid levels ($45,000 + $4,000 = $49,000), the bot will adjust the grid upwards:

  • It will cancel the lowest buy order and place a new buy order at the previous upper limit price.
  • If the price keeps increasing above the new upper limit price and the price difference ($49,000 + $4,000 = $53,000), the bot will repeat this process and adjust the grid upwards.

Example with trailing down:

Conversely, if the price falls below the lower limit price, and the price difference between the grid levels ($33,000 - $4,000 = $29,000), the bot will adjust the grid downwards:

  • It will cancel the highest sell order and place a new sell order at the previous lower limit price.
  • If the price keeps decreasing below the new lower limit price and the price difference ($29,000 - $4,000 = $25,000), the bot will repeat this process and adjust the grid downwards.
  • Originally, the bot placed a buy order at $25,000 and a series of sell orders from $33,000 to $45,000 based on the price gap.
  • If the price goes above the upper limit price and the price gap ($45,000 + $4,000 = $49,000), the bot will move the price range up by canceling the original buy order and place a new buy order at the old upper limit price ($45,000).
  • If the price keeps going up above the new upper limit price and the price gap ($49,000 + $4,000 = $53,000), the bot will move the price range up again by canceling the buy order from the lower limit price ($29,000), and placing a new buy order at the old upper limit price ($49,000).
  • The new price range now becomes $33,000 to $53,000. The bot will perform like a normal grid bot if the price remains in this range. If the price keeps going up above the new upper limit price and the price gap ($53,000 + $4,000 = $57,000), the bot won’t move up, because the trailing up limit is $54,000.
  • In this example, the trailing up count is 2.
  • If at this point the price starts to fall below the lower limit price and the price gap ($33,000 - $4,000 = $29,000), the bot will move the price range down by canceling the original sell order and place a new sell order at the old lower limit price ($33,000).
  • If the price keeps going down below the new lower limit price and the price gap ($25,000 - $4,000 = $21,000), the bot will move the price range down again by canceling the sell order from the upper limit price ($45,000), and placing a new sell order at the old lower limit price ($25,000).
  • The new price range now becomes $21,000 to $41,000. The bot will perform like a normal grid bot if the price remains in this range. If the price keeps going down below the new lower limit price and the price gap ($21,000 - $4,000 = $17,000), the bot won’t move down, because the trailing down limit is $20,000.
  • In this example, the trailing down count is 3.

Why can trailing lead to the creation of reverse positions for long and short grids ?

When using the Trailing Down feature for long grids or the trailing up feature for short grids, it's important to understand that these functions operate counter to the grid's original direction. This can result in the creation of reverse positions, which may not align with your initial trading strategy.

1. Impact on long grids (Trailing down enabled)

Scenario: In a continuous downtrend, enabling the trailing down function for a long grid can lead to the creation of short positions.

Mechanism: As the market price drops, the entire grid adjusts downward. Since the trailing down feature keeps the quote amount for each grid order, meaning more of the base asset is sold as prices decline. This increased selling pressure within the adjusted price range can lead to the formation of short positions, even though the grid was initially set up to take long positions.

2. Impact on short grids (Trailing up enabled)

Scenario: In a continuous uptrend, enabling the trailing up function for a short grid can result in the creation of long positions.

Mechanism: As the market price rises, the grid adjusts upwards. The trailing up feature ensures that the quote amount per grid order remains constant, resulting in the purchase of more of the base asset as prices rise. This accumulation within the new price range can lead to the formation of long positions, contrary to the original short strategy.

How to calculate the quantity in trailing functions?

In a trailing up or down grid trading strategy, each grid maintains the same quote value, rather than the base quantity, due to the fluctuating price range. While in traditional grid trading, each grid usually has the same amount of the base currency (e.g., BTC in a BTC/USDT perpetual contract) regardless of the grid’s price level.

1. Grid quantity per order in quote asset
The average cost ratio, which accounts for any open loss for each order, is used to calculate the quantity for each grid.

The formula for calculating the trailing grid quantity in quote is as follows:

grid_qty in quote = adjust_coef * initial value* avg_cost_ratio / (grid_count+1)

In this formula:

  • assuming_price (BUY) = price
  • assuming_price (SELL) = max(mark_price, price)

For sell orders:

  • cost_ratio = price / assuming_price

For buy orders:

  • cost_ratio = min(markPrice,price)/ assuming_price
  • avg_cost_ratio = sum(cost_ratio) / (grid_count + 1)

If a trigger price has been set, the mark_price should be changed to this trigger price. The "assuming price" is the expected execution price for a buy or sell order in the context of a trailing up grid trading strategy. This assuming price is used to adjust the order quantities to maintain a constant quote value across each grid.

Please note:

The price range in a trailing up or trailing down strategy is not fixed. As the asset price rises or falls, the bot adjusts the price grid upwards or downwards, canceling lower buy orders and placing new ones at higher prices, or canceling higher sell orders and placing new ones at lower prices. By ensuring each grid holds the same quote value, the bot can maintain a consistent investment size across changing price levels, allowing for more efficient use of capital and enabling the grid to follow upward and downward movements in a rising market.

Example: Assume that each grid should hold a value of $300. If the price of BTC is $30,000, you would buy/sell 0.01 BTC per order. However, if the price rises to $33,000, you would adjust the quantity to approximately 0.00909 BTC so that the quote value remains at $300.

Using the parameters from the above section, the formula for calculating the grid quantity in the quote asset is:

Grid Qty in Quote = adjust_coef * initial margin * leverage * avg_cost_ratio / (grid_count + 1)

= 0.95 * 500 * 5 * 1 / (5 + 1) = 395.83 USDT

2. Minimum initial margin

The minimum initial margin is calculated similarly to the general guidelines. First, the smallest quantity (min_qty) that the bot can trade is calculated, and then it is used it to calculate the minimum initial margin:

Min_qty = Max(minQty, minNotional/grid_lower_limit)

Then,

min_initial_margin = max((grid_count+1) * min_notional, (grid_count+1) * trailing_coef * initial_grid_upper_limit * min_qty)/ Leverage

Please note:

For ETHBTC perpetual contracts, values are rounded to 4 decimal places; for other symbols, they are rounded to 2 decimal places.

Example calculation:

  • min_qty= max(0.001,100/25000) = 0.004 BTC
  • Min Initial Margin = Max((5 + 1) * 100, 5 * 2 * 45,000 * 0.004) / (5 + 1) = 432 USDT

3. Maximum trailing up count

The maximum number of times the bot can adjust the price grid upwards for a trailing up grid is calculated as follows:

  • First, calculate the estimated maximum price the bot can handle:

Estimated_trailing_cap= Min(initial margin * initial leverage/min_qty, maxPrice)

  • Then, calculate the maximum trailing up count:

Max Trailing Up Count = (Estimated_trailing_cap - Initial Upper Limit)/Price Difference

Please note: This value is rounded down to the nearest integer.

Example calculation:

  • Estimated_trailing_cap = Min (500 * 5 / 0.004, 4,529,764) = 98,958.33
  • Max trailing up count = (98,958.33 - 45,000) / 4,000 = 13.49, rounded down to 13

4. Trailing cap price

The maximum price at which the Trailing Up grid bot will stop adjusting the price grid upwards as follows:

Trailing Cap Price = Initial Upper Limit + Price Difference * Max Trailing Up Count

Please note: This value is rounded to the nearest tick size.

Example calculation:

Trailing Cap Price = 45,000 + 4,000 * 13 = 97,000

How to calculate matched profits?

In trailing up orders, matched profits equals the sum of all matched profits from buy and sell orders:

Matched Profits = (Sell Order Average Price - Buy Order Average Price) * Matched Sell Order Size - Matched Trading Fee

Example calculation:

To calculate the matched profits for the sell and buy orders:

1. Matched size

The matched quantity is the lower quantity between the buy and sell orders, which is 0.05 BNB.

2. Matched trading fee

The matched trading fee is calculated as follows:

Matched Trading Fee = Buy Order Fee for Matched Size + Sell Order Fee for Matched Size

= (0.05/0.06) * 0.00227094 + (0.05/0.05) * 0.0019099

= 0.00380235 USDT

3. Matched profits for this order

The matched profits are calculated using the following formula:

Matched Profits = (Sell Order Average Price - Buy Order Average Price) * Matched Sell Order Size (matched size) - Matched Trading Fee

= (381.980 - 378.490) * 0.05 - 0.00380235

= 0.17069765 USDT

To learn more about the Binance Futures Grid Bot, visit this FAQs page.