AB Universal Grid. Compensatory trailing for the order grid
[Русский] - [English] - [中文] - [Español] - [Português] - [日本語] - [Deutsch] - [한국어] - [Français] - [Italiano] - [Türkçe]
AB Universal Grid:
For MT5: https://www.mql5.com/en/market/product/145321
For MT4: https://www.mql5.com/en/market/product/147482
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.
This is exactly what a compensatory trailing stop (CTS).
- 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
- 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.
- 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.
CTS — Compensatory trailing stop for the grid
- 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.
- 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
- The main goal is to compensate for as many losing orders as possible with profitable ones (starting with the most problematic ones).
- The second goal is to trawl profits (additional points).
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.
VCTS — Virtual Compensatory Trailing Stop
- 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
- The stop is not visible to the broker
- You can protect any volume, even the smallest ones.
- 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)
- 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 |
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.
AB Universal Grid:
For MT5: https://www.mql5.com/en/market/product/145321
For MT4: https://www.mql5.com/en/market/product/147482
Conclusion
Good luck and profit!


