AB Universal Grid. Compensatory trailing for the order grid

AB Universal Grid. Compensatory trailing for the order grid

1 July 2026, 21:40
Aleksandr Blinov
0
19

[Русский] - [English] - [中文] - [Español] - [Português] - [日本語] - [Deutsch] - [한국어] - [Français] - [Italiano] - [Türkçe]


Introduction

Grid trading is effective, but there's one problem. When the grid stretches, market volumes become large, and the average breakeven point moves far away from the price. Some positions are profitable, but you're afraid of a reversal, because a pullback could wipe out all your accumulated profits. Or worse, go into the red.

A standard trailing stop for a grid helps, but not always. What if you could close the grid in sections, gradually locking in profits while simultaneously "eating" losing positions?

This is exactly what a compensatory trailing stop (CTS).

Let's look at three approaches implemented in the AB Universal Grid advisor:
  • TSG — simple trailing stop for the grid (from the total breakeven)
  • CTS — compensatory trailing stop (a group of one losing position)
  • VCTS — virtual compensatory trailing stop (with division into minimum slices)

Let's go.


TSG — Simple trailing stop for the grid

Let's start with how trailing stop occurs in most cases in grid trading.

The logic is simple:
All open positions in the same direction (for example, all BUY positions) are taken. The overall breakeven point is calculated—the weighted average price of all positions. It's as if they were a single, averaged position.
Trailing stop starts from this level..

What are the goals of this approach?:
  1. Protect your overall position when the price moves against the grid. If the price reverses, your stop loss will be triggered, locking in your gains.
  2. Move the stop loss along with the price if it moves toward our grid. The further the price moves, the higher the stop loss moves. This allows you to earn additional pips.

Example:

You have 5 long positions. The total breakeven is 1.1040. You set a trailing stop of 30 pips. The stop is at 1.1070..

The price rises to 1.1100—the stop is pulled to 1.1070. The price rises to 1.1120—the stop is at 1.1090..

If the trade reverses, all 5 positions will close at the stop loss level. The result will be close to zero or a small gain.


It all seems logical. But there's a problem..

CTS — Compensatory trailing stop for the grid

What should you do if the grid is stretched quite wide? Market volumes are high, and the average breakeven level is far from the price. You just want to break even, but the price never reaches the overall breakeven..

Let's think differently..

We have some profitable positions and some losing ones. We are not obligated to take all losing positions into account..

CTS logic:

Let's take the losing position furthest from the price (the most problematic one, which is deeply in the red) and all the profitable ones. We'll calculate the breakeven level only for them..

Why the furthest one? Because it's the hardest to close. If we can offset it with profitable ones, then we'll be able to handle the more immediate unprofitable ones even more easily..

The breakeven level for this group will be significantly closer to the current price than the overall breakeven. The price is much more likely to reach it..

And now we will trail stop loss only for this group (all profitable ones + one farthest unprofitable one).

What does this give?:
  • During a rollback, we won't lose the profit from profitable orders. And with this profit, we'll offset the loss from the most problematic, unprofitable order.
After closing such a group:
  • a smaller volume remains in the market (the remaining unprofitable positions that were closer to the price)
  • free funds appear for further actions
  • there is a small profit left

But that's not all.

CTS doesn't work just once. It constantly calculates breakeven level variations in real time.
If the next calculation reveals that another unprofitable order (the next one farthest from the price) can be included in the group, it is immediately added.
Yes, the stop loss will move to a more unfavorable position (further from the price). But on the other hand, more unprofitable positions will be protected by the trailing stop.

CTS Priorities:
  1. The main goal is to compensate for as many losing orders as possible with profitable ones (starting with the most problematic ones).
  2. The second goal is to trawl profits (additional points).

That is, first we insure the maximum amount of loss, and only then think about how to move the stop closer to the price.

An example of CTS operation:

Grid: 3 profitable positions, 2 losing ones. The price is currently 1.1070. Losing ones: #4 (1.1060, closer to the price) and #5 (1.1080, further from the price).

Step 1. Group: 3 profitable + #5 (the furthest losing). Breakeven: 1.1030. Stop: 1.1060. Price rises.

Step 2. The price has moved further. CTS sees that it can add a second loss-making order (#4). It does so. The breakeven is recalculated and becomes 1.1045. The stop is moved to 1.1075 (further from the price). But now both loss-making orders are protected.

Step 3. The price reverses. The stop is triggered at 1.1075. Three profitable trades are closed, plus two losing ones. The result is a small profit or zero.


Important note: TSG and CTS use real stop-loss orders. You can open your terminal and see where your stop-loss orders are located. They are stored on the broker's server and will be triggered even if the connection is lost.

VCTS — Virtual Compensatory Trailing Stop

CTS has one drawback.

If the furthest losing position has a large volume relative to the profitable ones, then it can be difficult for the group to reach the breakeven level.

Imagine you have two profitable positions of 0.10 lots each and one losing position of 1.00 lots. The weighted average price will be very close to the price of the losing position. Even a small profit on the winning positions will be spread out over the large volume of the losing position. Breakeven will be far away, and the price will never reach it..

How to solve this problem?

Let's virtually break down all losing positions into minimum lots (slices). For example, a losing position of 0.50 lots is transformed into 50 virtual positions of 0.01 lots each, each with its own opening price (the same for all slices of a single position).

And now we will do the same calculations as in CTS:
  • We take all profitable positions
  • We add one virtual slice (0.01 lot) from the furthest unprofitable position (the most problematic one)
  • We calculate the breakeven point for this group
What happens?

Now the breakeven point is very close. Because the added loss-making volume is minimal. The group is almost entirely out of profitable positions.

The probability that the price will reach this level and activate the trailing stop increases sharply.

What's next?

As the price continues to move into profit, VCTS adds more and more slices to the group—second, third, tenth, hundredth. Moreover, slices are added starting from the furthest losing position, then from the next, and so on.

The further the price moves, the more losing trades are protected. And the more losing volume will be closed when the trade reverses.

The key difference between VCTS and CTS:

VCTS uses a virtual stop-loss. Why?

Because it's impossible to set a real stop-loss for part of a position. The broker doesn't allow it. You can only close part of a position at the market price at the time of decision.

Therefore, VCTS maintains virtual records: it remembers the stop-loss level, but doesn't set it on the account. When the price reaches this level, it issues a partial closure command.

Advantages of a virtual stop:
  • The stop is not visible to the broker
  • You can protect any volume, even the smallest ones.

Disadvantages of a virtual stop:
  • If the connection is broken, the protection will not work.
  • The terminal needs to be running continuously (which is a given when the advisor is running)
The main advantage of VCTS over CTS:

You can close losing positions in parts, rather than in their entirety. One minimal cut at a time. This allows you to:
  • Start trailing from the minimum threshold (breakeven is very close)
  • Very smoothly increase the protected loss volume
  • Don't wait for the price to reach a "heavy" breakeven with high volume

VCTS example:

Losing position of 0.50 lots. Minimum cutoff is 0.01 lots.

Step 1. Group: 3 profitable positions + 1 cutoff (0.01) from the furthest losing position. Breakeven is almost at the level of the profitable positions. The price quickly reaches it. Trailing is activated.

Step 2. The price rises. We add the 2nd, 3rd, and 4th cuts. The breakeven point gradually shifts, but remains close.

Step 3. The price has risen by 100 points. The group now contains 30 cutoffs (0.30 lots). The remaining unprofitable position is 0.20 lots.

Step 4. Reversal. The virtual stop is triggered. A partial closure occurs: 3 profitable positions are closed completely, plus 0.30 lots of the losing position. The remaining 0.20 lots remain in the market.

With the next upward movement, you will again begin to assemble a group - now with the remaining 0.20 lots.

The cycle repeats until the losing position is completely closed.


Comparison of three approaches

Criterion 
TSG (simple)
CTS (compensatory)
VCTS (virtual)
What is included in the group All positions in the direction All profitable + N loss posinions (in full) All profitable + N slices (0.01 each)
What loss-making level are we starting with
From the farthest (problematic) From the farthest (problematic)
Group breakeven Far (average for all) Closer to the price Very close to the price
Stop-loss type Real Real Virtual
Can I close part of a losing position No No 
 Yes (by slices)
Protection against connection failure ✅ Eat ✅ Eat ❌ No
The stop is visible to the broker ✅ Yes ✅ Yes ❌ No
What to choose?

TSG (Simple trailing is suitable when the grid is shallow, the volumes are approximately the same, and you are ready to close with one portfolio.

CTS (Compensatory (with a real stop) — when the grid is stretched, there are several losing positions of varying sizes. This allows you to gradually close your losses, starting with the most problematic positions. Plus, a real stop is reliable in the event of a connection failure.

VCTS (virtual) — for complex situations where the losing position significantly exceeds the winning position. Or when you need to initiate trailing as quickly as possible with a minimal threshold. The downside is that a virtual stop requires the terminal to be running continuously.


Conclusion

Grid trailing isn't always an all-or-nothing proposition. The offsetting approach offers flexibility: you can hedge losing positions gradually, starting with the most problematic ones and increasing the volume as the price moves.

CTS takes entire losing positions and uses a real stop-loss. VCTS uses minimal cuts and a virtual stop, allowing for almost immediate trailing, but requires constant terminal operation.

The approach you choose depends on your grid, risk tolerance, and broker trust. But one thing is certain: if you're trading a grid and encountering the "breakeven point is too far" problem, compensatory trailing stop.

Good luck and profit!