What Is Long/Short Grid Trading
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.
Read more about Grid trading.
What is Long/Short Grid?
Long/Short Grid 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 and simultaneously placing buy-orders at every $1,000 below the market price of BTCUSDT, while also placing sell-orders at every $1,000 above BTCUSDT contract’s market price. 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.
Setting up a Long/Short Grid trading strategy
The grid trading bot systematically executes buy- and sell-limit orders based on the user’s parameters. Here’s how you can set up your first long/short grid strategy.
1. Go to the Futures trading interface and click [Grid Trading] on the top menu bar.
The first parameter that you must select is the contract on which the trading bot will be deployed. In this example, we will be using BTCUSDT perpetual contract.
2. 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 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 is greater than the grid trading range, the grid strategy will start with zero position.
3. Assign the initial margin of the position. The system will calculate your Initial Margin value based on the number of grids, leverage, and the strategy’s price range. Note that the denser the grid, the greater the corresponding initial margin.
Please note that the notional value for each grid order must be greater than the minimum requirement. 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 less than the minimum requirement, a notification will indicate the minimum initial margin required to activate the grid strategy.
Please ensure that your available balance and maintenance margin is higher than the initial margin to avoid liquidation.
4. 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 an asset’s 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 and allows you to make profits 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 [Active Grid] tab to find grid trading details.
To end the grid trading system, click [Terminate].
Short Grid Example
Consider a short grid strategy with a configured price range between $9,800 to $10,200 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. The following scenario shows how a short grid strategy will be activated.
In this case, the lowest sell-limit order ($9,800) is excluded, and the subsequent sell orders are placed upwards from $9,900 to $10,200. If the initial position is transacted between the prices of $9,900 and $10,000, the initial grid orders will be 2.
Since the current market price is $10,010, the sell orders at price of $9,900 and $10,000 to 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 would be updated as follows:
To summarize, for short grid strategies, the first sell-limit order will trigger the initial short position. Simultaneously, subsequent sell-limit orders will be populated in ascending order towards the highest boundary of your configured grid. Then, buy-limit orders will be placed in the market once the initial short position is triggered, set 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.
Long/Short Grid Profit and Loss Calculation
The profit and loss calculations for a long/short grid strategy consider 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 P&L||The profit and loss of unmatched grid transactions||(The latest contract price - unmatched grid pair’s average price) * Unmatched volume|
|Total Realized P&L||Total realized Profit & 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 total profit, the first one is using unmatched P&L and matched profit, the second one is using realized profit and unrealized P&L.
Realized profits & unrealized P&L methodology:
Total Profit = Net Realized Profit + Unrealized P&L
First, calculate your net realized profits. Net realized profit is calculated as the gross realized profit minus total fee expenses of all the completed orders of the grid strategy.
Note: Fees paid for each trade can be found on the trade history page.
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 P&L. 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 P&L and entry price in the [Positions and Orders] window as shown below.
Finally, add both Net realized profits and unrealized P&L to derive your total profits.
Total profits = Net Realized Profit + Unrealized P&L = 0.38535442 + 0.26 = 0.64535442 USDT
Unmatched P&L and Matched Profits methodology:
Total profit = Matched profit + Unmatched PNL
To calculate total profit, you must determine your matched profits first. Matched profit is the sum of the profits, you can view your matched profits in the [Completed] tab as shown below.
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 the avg. filled price of unmatched orders.
The avg. filled price of unmatched orders = (∑Total amount of unmatched orders) / (∑Quantity of unmatched orders)
For example, if below (refer to screenshot) are the completed orders which are pending to be matched.
Then the avg. filled price of unmatched orders = (10.047124000 + 10.047124000 + 10.047124000) / (0.004 + 0.004 + 0.004) = 2511.781
The unmatched PNL = (last price - avg. 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 2522, position size is equal to the total size of unmatched orders, which is 0.012.
Therefore, the unmatched PNL = (2522 - 2511.781) * 0.012 = 0.122628
Finally, sum up the calculated matched profits and unmatched P&L.
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:
As such, the last buy-order ($10,000) will be matched with a corresponding sell-order at $10,100. Subsequently, the remaining buy orders will be matched at a higher selling price, respectively.