Skip to main content

Stepgridhedge

This approach adopts the grid method from the stepgrid strategy and applies it to trade both long and short positions in a futures market using hedge mode. It employs the same order triggers as stepgrid for spot trading, but with a distinct implementation.

In Gunbot, trading with hedge mode involves treating the two sides as separate trading pairs, such as USDT-BTC-LONG and USDT-BTC-SHORT. Both sides can maintain a position simultaneously. This specific strategy operates on the long side, which means that its settings and targets are exclusive to this pair. It trades both long and short positions using these targets.

note

Currently compatible with Bybit futures, okGunbot & OKX swap markets.

Remember to activate hedge mode on your chosen exchange. For okGunbot and OKX, also ensure you configure account units as contracts in your profile settings on the exchange.

Trading behavior

While the strategy is somewhat intricate, it can be summarized as follows:

When the price reaches the sell step:

  • Close a profitable long position, if available
  • Otherwise: apply DCA to short positions or skip the step

When the price reaches the buy step:

  • Close a profitable short position, if available
  • Otherwise: apply DCA to long positions or skip the step

Grid targets are situated around the last order rate of either the long or short side's most recent order. If a step is skipped, the targets will be adjusted around that rate. Additionally, unconfigurable methods prevent DCA orders from accumulating too quickly.

Let's examine several example trades to clarify the strategy and understand its charts:

Short position is active and the price is better than the average entry

Almost taking profit on the short side

The short pair chart displays past trades and the current position's average entry price. In this situation, the price is profitable, covering trading fees, and the bot can soon begin closing the short position. No ROE target is set, with "profitable" referring only to covering trading fees.

Long side chart displays current targets

Strategy is best monitored on the long side

The long side chart presents the current targets. In this specific case, the long position is significantly distant from the average entry and is not permitted to further increase its size. As a result, reaching the next lower target will lead to a partial close on the short side.

DCA target exceeded, trailing activated

Trailing ranges are based on recent volatility

The price has now fallen below the DCA target, initiating an automatic price trailing process. Once trailing concludes, the short side will take partial profits.

Trailing completed

Trailing is fully automatic

After the completion of trailing, new targets are established on the long pair around the rate where trailing concluded. No new orders appear on the long side because the anticipated next order was on the short side.

Partial short position closure

Short trade taking profit

A partial close order emerges on the short side, reducing the position size by approximately 30%. An open short position remains.

Fast forward through several trades

Positions close in several steps

Advancing in time, the short side continues to place several partial close orders and adds to the position each time the upper step is reached. By increasing the position even during profitable times, the strategy can remain active for extended periods during unidirectional price movements.

tip

This example illustrates just one possible scenario, as it's challenging to depict all potential situations. It's common for one side to trade profitably for a while, while the other side slowly averages down its position.