For the complete documentation index, see llms.txt. This page is also available as Markdown.

Classic hedge in the Backtester

A classic hedge in a Backtester checks the opposite position along with the main strategy on historical data. The main position is opened by the strategy from the constructor, and the hedge is connected by a given fitting. Real orders don't come from that calculation.

This tool is part of the VIP package, available for a year's PRO purchase. The terms are Free, PRO and VIP. For the aggressive mode, a separate Emulation of the aggressive hedge is designed.

1. The first. Prepare the main strategy

Open the Baxter. — Backtester Select the exchange, asset and destination, fill out the dates, deposit, first order volume, leverage, commission and average settings. Enter the entry and exit conditions in the constructor. Details of the article are given in the Backtester article: first calculation. — Backtester: first count.

For the first check, leave one pair. If you've used multi mode before, open it and click Clean: the pairs you select there have priority over the asset in the top box.

The rules for choosing multiple pairs are outlined in the article Multivariate: Checking Strategy on Multiple Assets. — Multivariate: checking the strategy on several assets

Two. Open the tab Hedge robot

In the VIP tools block, before the designer, select Hedge Robot. The Robot Hedge Settings block opens (classic mode). Selecting this tab includes a hedge for calculation; switching to another VIP tab disables it.

Active English tab of Hedge robot in BacktesterThe parameters of classical hedge and hedging levels.
A demonstration of the classic hedge field in the English interface.

When the hedge is turned on, the x200 speed switch (VIP) is removed and becomes inaccessible. For this test, a conventional engine is used.

3rd. Set the level of the opposite position

In the Hedging levels section , fill out two fields for each row:

  • The percentage of the TVX how much the price should go against the main position relative to its average entry price.

  • Volume from the main position, % the total target volume of the counter position at this level relative to the current volume of the main position.

For example, levels of 20% and 40% in volume mean consistent goals for the overall hedge. If you've already got 20%, the next level brings the hedge to 40%, taking into account the model's limitations. It's an explanation of mechanics, not the finished parameters.

Click Add level to create a line; the basket removes the extra one. Fill the entrance and volume with positive numbers and check the sequence of goals. Empty lines and zero lines don't participate in the sent levels. If there's not a single correct line left, the calculation will go without the hedge parameters.

A demonstration example is a long to 1 unit with an average price of 100. The 5% threshold corresponds to the 95 price and the hedge goal of 0.20 units; when the 10% threshold is 0.40. If 0.20 remains open, another 0.20 is added to the next goal taking into account the limitations.
A demonstration example is a long to 1 unit with an average price of 100. The 5% threshold corresponds to the 95 price and the hedge goal of 0.20 units; when the 10% threshold is 0.40. If 0.20 remains open, another 0.20 is added to the next goal taking into account the limitations.

Four. Please specify the opening and closing conditions

The Minimum position size sets the threshold for the value of the underlying position to begin hedging. In the absence of the hedge components, the value of the underlying position at the current price shall be higher than this value.

The percentage of the pair closure sets the targeted calculation result of the main and counter positions taking into account the accumulated hedge result. The interest is calculated relative to the sum of both positions at their average entry prices, not relative to the deposit. It's a condition of the model, not a promised result after all the actual expenses.

Take the main position's profit tag is managed by the main position's profit tag during hedge work. Conform this to the terms of the basic strategy: it changes the behavior of the test combination.

5th. Set up the steps and safe zones

Set SM trigger, % determines the favorable price movement for the hedge leg, after which the model sets its stop. SM at breakeven for the hedge leg, % sets the price of this stop relative to the entry price of the corresponding part.

The Maximum number of active SMs limits the number of simultaneously active stops. When the limit is reached, the model can shift the protection between the parts. Having an open part of the hedge doesn't mean it has an active stop all the time.

Min. volume without SM and Max. volume without SM set limits on the addition of volume without footing in percentages from the main position. These constraints are applied together when both non-zero values are entered.

Safe zone to main, % and Safe zone to hedge, % set the boundary of the zone from the stop price in two directions. Inside this zone, the model does not add a new level of hedge, even if the given entry is reached.

In the form of a Backtester, the parameters are set for the chosen direction of the main strategy. The rules for setting a living robot are described separately in the article Parameters of classical hedge; the permissible fields and limits of the two forms may differ. — The parameters of the classical hedge

6. Make the calculation and check the result

Before you click Count, make sure that The hedge robot tab is selected, that there are positive levels filled, that the acceleration mode is turned off, and that the selected pairs and dates are correct.

The result is to open The strategy tab and check for saved hedge settings. Then look at the trades and the hedge, including the number of exposures, the profit and commission, if any. The absence of openings may mean that the main strategy has not opened a position or the conditions for drawdown, minimum volume, footing or safe-zone have not been met.

For comparison, repeat the same period with the same basic strategy without a hedge: move to another VIP tab. If you compare the usual engine in both versions, manually remove the restored accelerator. Compare the overall score, commission, drawdown and position at the end of the period.

The work with the saved launches is described in the article Backtest results and archive. — Backtest and archive results The historical calculation assumptions in the Baxter article: parameters and limitations of the model. — Backtester: parameters and limitations of the model The calculation does not fully reproduce the execution on the exchange and does not guarantee profit.