Contract Grid

What is Contract Grid?

Contract Grid Strategy is an automated contract trading strategy that earns profits by buying contracts at low prices and selling them at higher prices. Users need to set a specific price range, including the highest and lowest prices, and determine the number of grids to be segmented. Once set, the strategy will automatically calculate the buy and sell prices for each small grid and place orders automatically. As market prices fluctuate, the strategy captures the profits generated by these fluctuations.

Three Types of Contract Grid

Contract Grid strategies have a certain bias towards bullish or bearish positions, allowing for the flexibility to conduct long arbitrage, short arbitrage, or both within a specific range.

  1. Long Grid When users believe that prices will fluctuate and rise within a certain range, they can use a long grid. When the price crosses a grid line downward for the first time, a buy-long strategy will be executed, and a sell-to-close order will be placed at the next higher grid. This allows for continuous arbitrage in a fluctuating market. Contract Grid has a leverage effect, which means that the capital used for each grid trade is greater.

  2. Short Grid When users believe that the future market trend will tend towards a volatile decline, and they want to capitalize on the profits from falling prices within the volatility range, they can use a short grid. When executing a short grid strategy, a sell-short strategy will be executed when the price crosses a grid upward for the first time, and a buy-to-close order will be placed at the next lower grid. This allows for profits to be made by closing high-level short orders at lower levels in a continuously declining and volatile market.

  3. Neutral Grid When users believe that prices will fluctuate up and down around a central pivot point, they can use a neutral grid. The neutral grid opens short/closes long positions above the market price when the strategy is initiated, and opens long/closes short positions below.

How does grid trading work?

Currently, it supports USDT contracts, and it will support coin-based contracts in the future.Taking the BTCUSDT contract as an example, the set parameters are:Grid Highest Price: 60,000 USDT Grid Lowest Price: 40,000 USDT Number of Grids: 5 grids/Arithmetic grid Quantity per Trade: 0.001 BTC Contract Price at Strategy Creation: 50,000 USDT Maker Fee Rate for Position Opening: 0.05%Based on the above parameters, the prices (in USDT) for this strategy's grid are: 60,000, 56,000, 52,000, 48,000, 44,000, 40,000.If running a neutral grid: During initial setup, sell orders will be placed above the latest market price, and buy orders will be placed below the market price. There will be no initial positions held.

Price

Direction

60000

Sell

56000

Sell

52000

Sell

48000

Buy

44000

Buy

40000

Buy

When the price drops to 47,000, and the buy order at 48,000 USDT is fully executed, this transaction is the first grid transaction and does not require re-hanging the order.At this point, the pending orders are as follows: holding a long position of 0.001 BTC.

Price

Direction

60000

Sell

56000

Sell

52000

Sell

48000

NA

44000

Buy

40000

Buy

How to set grid parameters?

Entry Web: Select "Contract Grid" to enter the trading page.

App : You can enter the trading page by selecting "Edit" -> "Contract Grid" or "Assets" -> "Bot Account" -> "Create".

  1. Isolated Margin Mode

In the current grid trading system, all grid presets are based on the isolated margin mode. The margin of all trading pairs in the user's strategy contract account is used independently.

  1. Selecting Strategy Direction

*After placing a grid trade order, the direction cannot be modified.

Choose the direction of the grid trade, long, short, or neutral.

  1. Price Upper and Lower Limits

*After placing a grid trade order, the set grid price lower and upper limits cannot be modified. If the price exceeds the highest or lowest grid range, no further positions will be opened. For example, if the current price of the BTCUSDT perpetual contract is 60,000 USDT, and you expect the price to start falling after exceeding 70,000 USDT. In this case, you can set the price upper limit as 70,000 USDT. When the price reaches or exceeds 70,000 USDT, no further positions will be opened within the grid.

  1. Arithmetic and Geometric Progression

*After placing a grid trade order, modifications cannot be made.

Arithmetic Grid: Each grid has an equal price difference.

An arithmetic grid uses an equal price difference to divide the price range from the lower grid limit to the upper grid limit.

The price difference formula for each grid is:

Price Difference = (Upper Grid Limit - Lower Grid Limit) / Number of Grids

Constructing the grid price range:

Price 1 = Lower Grid Limit

Price 2 = Lower Grid Limit + Price Difference

Price 3 = Lower Grid Limit + Price Difference * 2

...

Price n = Lower Grid Limit + Price Difference * (n-1)

When the upper grid limit is reached, n equals the number of grids.

For example, with a price difference of 100 for an arithmetic grid, the price sequence would be: 1,000, 1,100, 1,200, 1,300, 1,400... (each price is 100 higher than the previous one).

Geometric Grid: Each grid has an equal percentage price difference.

A geometric grid uses an equal price ratio to divide the price range from the lower grid limit to the upper grid limit.

The price ratio formula for each grid is:

Price Ratio = (Upper Grid Limit / Lower Grid Limit)^(1/Number of Grids)

The percentage price difference formula for each grid is:

Price Difference Percentage = [(Upper Grid Limit / Lower Grid Limit)^(1/Number of Grids) - 1] * 100% Constructing the grid price range:

Price 1 = Lower Grid Limit

Price 2 = Lower Grid Limit * Price Ratio

Price 3 = Lower Grid Limit * Price Ratio^2

...

Price n = Lower Grid Limit * Price Ratio^(n-1)

When the upper grid limit is reached, n equals the number of grids. For example, with a price difference percentage of 10% for a geometric grid, the price sequence would be: 1,000, 1,100, 1,210, 1,331, 1,464.1... (each price is 10% higher than the previous one).

  1. Number of Grids

*After placing a grid trade order, modifications cannot be made.

Lower Limit: 2

Upper Limit: 300

Note: The price difference cannot be less than the minimum price fluctuation. Otherwise, you need to adjust the number of grids or the upper/lower grid limits.

Calculations:

1) For an arithmetic grid, Price Difference = (Upper Grid Limit - Lower Grid Limit) / Number of Grids

2) For a geometric grid, Minimum Price Difference = Lower Grid Limit * (Price Ratio - 1), where Price Ratio = (Upper Grid Limit / Lower Grid Limit)^(1 / Number of Grids)

  1. Profit Per Grid

In grid trading, if the profit per grid is less than the order placement fee, a warning will be issued that the total grid profit may not be sufficient to cover the transaction fees. This data is for reference only.

1)Arithmetic Grid

  • a: Price Difference per Grid = (Upper Grid Limit - Lower Grid Limit) / Number of Grids

  • c: Transaction Fee Rate (Your current order placement fee rate)

The formulas to calculate the lower and upper limits of profit per grid are:

  • Lower Limit of Profit per Grid = (Upper Grid Limit * (1 - c)) / (Upper Grid Limit - a) - 1 - c

  • Upper Limit of Profit per Grid = (1 - c) * a / Lower Grid Limit - 2c

Example:

Price Range = 1,000 - 2,000, Number of Grids = 10, Fee Rate = 0.1%

  • Price Difference per Grid = (2,000 - 1,000) / 10 = 100

  • Lower Limit of Profit per Grid = (2,000 * (1 - 0.1%)) / (2,000 - 100) - 1 - 0.1% ≈ 5.05%

  • Upper Limit of Profit per Grid = (1 - 0.1%) * 100 / 1,000 - 2 * 0.1% ≈ 9.79%

2)Geometric Grid

  • b: Price Ratio per Grid = (Upper Grid Limit / Lower Grid Limit) ^ (1 / Number of Grids)

  • c: Transaction Fee Rate (Your current order placement fee rate)

The formula to calculate the profit per grid for a geometric grid is:

  • Profit per Grid = (1 - c) * b - 1 - c

Example:

Price Range = 1,000 - 2,000, Number of Grids = 10, Fee Rate = 0.1%

  • Price Ratio per Grid = (2,000 / 1,000) ^ (1 / 10) ≈ 1.0718 (or 107.18%)

  • Profit per Grid = (1 - 0.1%) * 1.0718 - 1 - 0.1% ≈ 6.97%

  1. Investment Amount

*After placing a grid trading order, modifications cannot be made. You can set a percentage of the investable amount, which determines your initial investment amount. For example, if you set the percentage to 50% and your account balance is 1000U, then your initial investment amount will be 500U.

Calculation of the Minimum Initial Investment Amount:

Neutral:

Minimum Initial Investment Amount = Minimum Limit Order Quantity * SUM(Prices) / (Leverage * Adjustment Factor)

Long/Short:

Minimum investment amount = (Minimum margin + Loss on opening position) / Adjustment coefficient

Minimum margin = sum (Minimum order quantity (in currency) * Pending order price) / Leverage

Loss on opening position = sum (Minimum order quantity (in currency) * Absolute value of {min[0, Direction * (Trigger price - Pending order price)]})

Calculation of the Maximum Initial Investment Amount:

Maximum Initial Investment Amount = Min(Available Balance in Contract Margin Account, Maximum Investment Amount, Maximum Leverage for Current Contract)

Neutral:

Maximum Investment Amount = Maximum Limit Order Quantity (Currency) * SUM(Prices) / (Leverage * Adjustment Factor)

Long/Short

Maximum investment amount = (Maximum margin + Loss on opening position) / Adjustment coefficient

Maximum margin = sum (Maximum order quantity (in currency) * Pending order price) / Leverage

Loss on opening position = sum (Maximum order quantity (in currency) * Absolute value of {min[0, Direction * (Trigger price - Pending order price)]})

Notes:

The adjustment coefficient is 0.8.

Order direction: 1 represents a long order; -1 represents a short order.

If a trigger price is set, the mark price should be replaced with the trigger price.

  1. Leverage

The maximum leverage is the maximum leverage multiple supported by the contract position.

  1. Quantity per Order

Neutral:

Number of Grids = Adjustment Factor * Investment Amount * Leverage / SUM(Prices)

Long/Short:

Each transaction quantity = Total investment * coefficient / (SUM(Pending order price) + SUM(Price + Leverage * Absolute value of {min[0, Direction * (Mark price - Pending order price)]}))

Pending order price refers to the price of each individual order.

Order direction: 1 represents a long order; -1 represents a short order.

If a trigger price is set, the mark price should be replaced with the trigger price.

  1. Total Investment Amount

*After placing a grid trading order, modifications cannot be made.

Total Investment Amount = Investment Amount * Leverage

  1. Advanced Conditions

*Optional, modifications can still be made after placing a grid order.

Trigger Price: The grid will be triggered when the latest price is higher or lower than the trigger price you set.

Stop Price: The grid will be stopped when the latest price is higher or lower than the stop price you set. Liquidate All Positions on Stop: You can enable this function to automatically liquidate all unclosed positions of the currency at market price when the grid stops.

  1. Other Notes

Please note that the following situations may lead to the failure of creating a new grid:

  • The number of grids exceeds the upper limit: You can create up to 10 contract grids.

  • Order quantity exceeds the upper limit.

  • Position amount exceeds the maximum position.

  • Number of orders exceeds the maximum limit order quantity per transaction.

View Running Grids

You can click "Details" in the order area to enter the grid page and view running or historical grids.

How to use grid trading AI-based parameters

  1. Go to the [AI] tab on the left to check the recommended parameters and enter your investment amount.

  2. Once you've decided the amount of margin that you want to allocate to your grid trading strategy, click [Create], and confirm your grid order so the system automatically places buy or sell orders at the preset prices. Please note that the AI-based parameters are set in a Neutral direction and in Arithmetic Mode by default.

  3. How are the AI-based parameters calculated?

Upper & Lower Price

  • Upper Band = MA + bbm * Standard Deviation

  • Lower Band = MA - bbm * Standard Deviation

Grid Number

Grid Number = (1 + buffer) * (grid_upper_limit - grid_lower_limit) / ATR

Notes:

  • Buffer is currently set to 20%;

  • ATR period selection:

    • For 7 days: use 30-minute candlesticks for the past 168 periods;

    • For 30 days: use 1-hour candlesticks for the past 360 periods;

    • For 180 days: use 1-hour candlesticks for the past 2160 periods.

Last updated