What is grid trading?
Grid trading automates the buying and selling of futures contracts. It is designed to place orders in the market at preset intervals within a configured price range. Grid trading is ideal for volatile and sideways markets when prices fluctuate in a given range. This technique attempts to make profits on small price changes.
For more details, please refer to What Is Futures Grid Trading.
What is long/short grid trading?
Long/short grid trading is a trend-following strategy that allows users to trade with the market trend within a grid trading system. This means you can open an initial position (long or short) according to your analysis, while simultaneously placing buy-limit and sell-limit orders at predetermined intervals to capitalize on market volatility and ranging conditions.
For example, a trader could open an initial long position in BTCUSDT to express his bullish view on Bitcoin. He can place buy orders at every 1,000 USDT below the market price of BTCUSDT, while also placing sell orders at every 1,000 USDT above the market price of BTCUSDT. This allows him to trade with the underlying trend within a grid trading system.
A critical difference between a long/short grid and a neutral grid is the initial opening position. For a long grid strategy, users will have an initial long position opened. Conversely, an initial short position will be opened for a short grid strategy.
How to set up a grid trading strategy?
The grid trading bot systematically executes buy- and sell-limit orders based on the parameters you set. Here’s how you can set up your first long/short grid strategy.
1. Log in to your Binance account and go to [Derivatives] - [Binance Futures Overview]. Click [Strategy Trading] - [Futures Grid].
Alternatively, you can access the Futures Grid Trading interface from the Binance Futures homepage by clicking [Strategy Trading] - [Futures Grid].
If you’re using the Binance App:
- To start trading using the USDⓈ-M Futures Grid, tap [Futures] - [USDⓈ-M Futures]. Then, tap [...] and select [Strategy Trading] - [Grid Trading].
- To start trading using the COIN-M Futures Grid, tap [Futures] - [COIN-M Futures]. Then, tap [...] and select [Strategy Trading] - [Grid Trading].
2. The first parameter you must select is the contract on which the trading bot will be deployed. In this example, we will be using the BTCUSDT perpetual contract.
3. Enter the parameters of your long/short grid strategy on the grid trading panel. The key parameters that you must include are:
- The upper and the lower boundaries of the price range;
- The number of orders to be placed within the configured price range;
- The width between each grid order;
- Initial margin.
If the current market price exceeds the grid trading range, the grid strategy will start without any position.
4. Assign the initial margin of the position. The system will calculate your initial margin value based on the number of grids, leverage, and price range you set. Note that the denser the grid, the greater the corresponding initial margin.
Please note that the notional value of each grid order must meet the minimum requirement. You can reduce the number of grids or increase the initial margin to ensure that each grid’s minimum notional value is met.
Insufficient Initial Margin Reminder
When the initial margin is lower than the minimum requirement, you will be notified to meet the minimum initial margin required to activate the grid strategy.
Please ensure that your margin balance is higher than the maintenance margin to avoid liquidation.
5. Click [Create] to place your grid order.
The grid trading bot also comes with enhanced functions that enable you to manage your positions and risk better. One of which is the trigger price. The trigger price is a predetermined price level at which the grid trading bot will be activated. This allows you to dictate when the system will be active when market conditions meet your criteria.
When a grid trade is triggered, the system divides the asset price range into several grid levels according to your parameters and sets pending orders for each price level. When the asset’s price falls, a buy order is executed, and a sell order is placed immediately at a high price. When the price rises, a buy order is placed directly at a lower price as soon as a sell order is executed. This strategy sets you up to buy low and sell high, allowing you to profit in volatile market conditions.
Additionally, you can set a stop-loss for your grid positions. Once the asset’s price crosses below or above the stop loss range, your entire grid position will be closed. This feature protects your position from incurring outsized losses when the market behaves unfavorably.
To monitor trading activity, click the [Running] tab to find grid trading details.
To end the grid trading system, click [End].
USDⓈ-M Futures Short Grid Example
Consider a short grid strategy with a configured price range between 9,800 USDT to 10,200 USDT and a grid quantity of 4.
Assuming that the quantity of sell-limit orders at each price is 1, and the market price (the latest transaction price) is 10,010 USDT. The following scenario shows how a short grid strategy will be activated.
In this case, the lowest sell-limit order (9,800 USDT) is excluded, and the subsequent sell orders are placed upwards from 9,900 USDT to 10,200 USDT. If the initial position is transacted between the prices of 9,900 USDT and 10,000 USDT, the initial number of grid orders will be 2.
Since the current market price is 10,010 USDT, the sell orders at the prices of 9,900 USDT and 10,000 USDT will be filled as the initial position. Once the initial position is filled, a buy order will be placed at the next lower price. The grid limit orders will be updated as follows:
To summarize, for short grid strategies, the first sell-limit order will trigger the initial short position. Simultaneously, the subsequent sell-limit orders will be populated in ascending order toward the highest boundary of your configured grid. Then, the buy-limit orders will be placed in the market once the initial short position is triggered, according to your strategy’s parameters.
Similarly, long grid strategies will be activated once the first buy-limit order is filled. Subsequently, all grid orders will be populated.
How to calculate long/short grid profit and loss?
The profit and loss calculation for a long/short grid strategy considers both the total matched profits and the unmatched profit and loss. In this case, completed transactions are recorded as matched transactions, while partially completed transactions are recorded as unmatched transactions. A matched transaction means that every short position (or long position) in the grid strategy is matched by a corresponding buy order (or sell order).
|Unmatched PnL||The profit and loss of unmatched grid transactions|
For USDⓈ-M Futures Grid:
(The latest contract price - unmatched grid pair’s average price) * unmatched volume
For COIN-M Futures Grid:
(1 / unmatched grid pair’s average price - 1 / the latest contract price ) * unmatched volume * contract multiplier
|Total Profit||Total matched profit and unmatched profit and loss since inception||matched grid income + unmatched grid profit and loss|
|Yield||Total return ROI||ROI = total profit / initial_margin * 100%|
|Annualized Rate of Return||Annualized total return APR|
APR = ROI * Year / T
(T is the running time of the strategy)
How to calculate the total profit of a grid strategy?
There are two ways of calculating the total profit. The first method uses the unmatched PnL and matched profit, and the second method uses the realized profit and unrealized PnL.
1. Realized profits and unrealized PnL
Total Profit = Net Realized Profit + Unrealized PnL
Let’s use the USDⓈ-M Futures Grid as an example.
First, calculate your net realized profits.
Net realized profit = gross realized profit - total fee expenses of all the completed orders of the grid strategy
Note: Fees paid for each trade can be found in [Trade History].
Total realized profit = 0.20596000 + 0.13932000 + 0.07268000 - 0.00642000 - (0.00123038 + 0.00122238 + 0.00121439 + 0.00321511 + 0.00321511 + 0.00321511 + 0.00321511 + 0.00482797 + 0.00483002 ) = 0.38535442
Next, calculate your unrealized PnL. Unrealized P&L is calculated based on the difference between the last price and the entry price of open positions. You can find your unrealized PnL and entry price under the [Positions and Orders] window.
Finally, calculate your total profits:
Total profits = Net Realized Profit + Unrealized PnL
= 0.38535442 + 0.26
= 0.64535442 USDT
2. Unmatched PnL and Matched Profits
Total profit = Matched profit + Unmatched PnL
Let’s use USDⓈ-M Futures Grid to illustrate the profit calculation.
To calculate the total profit, you must determine your matched profits first. Matched profit is the sum of the profits. You can view your matched profits under the [Completed] tab.
For example, if there are 3 matched orders:
Total matched profits = 0.20151451 * 3 = 0.60454353 USDT
Next, calculate your unmatched profits. Unmatched profits is the unrealized profit of filled grid orders that are not matched. It is calculated based on the difference between the last price and unmatched orders’ average filled price.
The average filled price of unmatched orders = (∑Total amount of unmatched orders) / (∑Quantity of unmatched orders)
Let’s use the below completed orders which are pending to be matched as an example.
The average filled price of unmatched orders = (10.047124000 + 10.047124000 + 10.047124000) / (0.004 + 0.004 + 0.004) = 2511.781
The unmatched PnL = (last price - average. filled price of unmatched orders) * current positions
Note: Current position is positive for long positions and negative for short positions.
If the last price is 2,522, the position size equals the total size of the unmatched orders = 0.012.
Therefore, the unmatched PnL = (2,522 - 2,511.781) * 0.012 = 0.122628
Total profit = Matched profit + Unmatched PNL = 0.60454353
+ 0.122628 = 0.72717153 USDT
How are positions matched?
Positions are matched using the First-In-Last-Out (FILO) methodology. Under FILO, orders that are filled first will be matched last.
Suppose a long grid strategy is filled in the following order:
The corresponding sell orders to be matched will be in the following sequence:
The last buy order (10,000 USDT) will be matched with a corresponding sell order at 10,100 USDT, and the remaining buy orders will be matched at a higher selling price.