> ## Documentation Index
> Fetch the complete documentation index at: https://help.vole.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Close on a Trend Reversal

> Closes a trade when the moving averages cross against it, or the directional indicators flip against it with enough trend strength.

> [!NOTE]
>
> This screen is part of the Vole Bot package.

**Close on a Trend Reversal** closes your trade when the trend turns against it. You choose how a turn is detected: the moving averages cross against you, the directional indicators flip against you with enough trend strength behind them, or either one. You can also require the trade to be in profit by a set amount before the rule may close it.

## When it acts

The rule looks at the candle that has just closed, on every candle while a trade is open.

* It does not look at all until the trade has been open for **Minimum candles held** whole candles.
* A reversal counts when it is seen on the last closed candle. For the moving-average cross, **Look back this many candles** also lets it count a cross from a few candles ago.
* Once a reversal is seen, the rule checks **Minimum profit to close (%)**. If the trade does not meet it, nothing happens on that candle. The rule asks again on the next candle.
* When both are satisfied, the bot closes the trade at market.
* Your exits are checked in a fixed order on each closed candle, and the first one that fires closes the trade. A stop or take profit that the candle has already reached comes first, then [Heikin Ashi Reversal Close](https://help.vole.bot/en/execution-rules/pro-exit-modules/heikin-ashi-reversal-close.md), then this rule, then [Volume Spike Rule](https://help.vole.bot/en/execution-rules/pro-exit-modules/volume-spike-rule.md). See [Exit Rules](https://help.vole.bot/en/execution-rules/exit-rules.md).

On the policy and instance forms, the rule is listed under **Exit Trigger** in the **Pro Exit Modules** list.

## How a reversal is detected

**How a reversal is detected** has three choices.

* **Moving averages cross against you.** Two exponential moving averages (EMAs) of the closing price are compared, a fast one and a slow one. For a long, the fast average must have been at or above the slow one and then move below it. For a short, the reverse.
* **Directional indicators flip against you.** The two directional-indicator lines show buyer strength and seller strength. For a long, buyer strength must have been at or above seller strength on the candle before, and now seller strength is above it. For a short, the reverse. The flip only counts while the trend is strong enough, as measured by ADX. See **Minimum trend strength (ADX)** below.
* **Either one.** The trade closes on whichever of the two happens first.

## Settings

| Label on the form | What it means | Unit and range |
| - | - | - |
| **How a reversal is detected** | Which detector counts: the moving averages cross, the directional indicators flip, or either one. | Choose one |
| **Fast moving average (candles)** | How many candles the fast average spans. A smaller number follows price more closely. | Whole candles, 2 to 200 |
| **Slow moving average (candles)** | How many candles the slow average spans. Use a larger number than the fast one. | Whole candles, 3 to 400 |
| **Look back this many candles** | Moving-average cross only. The cross may have happened on any of this many most recent closed candles. Set to 1, only the last closed candle counts. The directional-indicator flip is always judged on the last closed candle. | Whole candles, 1 to 50 |
| **Minimum trend strength (ADX)** | Directional-indicator flip only. A flip is ignored while the trend is weaker than this. ADX runs from 0 to 100, and traders commonly read a value below 20 as a weak trend. Set to 0, a flip counts at any strength. | ADX reading, 0 to 100 |
| **Minimum candles held** | The rule does not look until the trade has been open this many whole candles. The lowest you can set is 1; the box starts at 2. | Whole candles, 1 to 500 |
| **Minimum profit to close (%)** | How much profit the trade must show for the rule to close it. See below. | Percent of your entry price, -50 to 50 |

### How Minimum profit to close works

The profit is measured at the closing price of the candle that just closed, against your entry price. For a short, profit means the price has fallen.

* **0** means no profit requirement. The rule can also close a trade that is in loss.
* **A positive number**, for example 1, means the trade must be 1 percent or more in profit.
* **A negative number**, for example -2, means the rule closes only while the loss is smaller than that. With -2, a loss of 1 percent may be closed, and a loss of 3 percent is left alone.

## Worked example

The numbers below are made up to show how the rule works. They are not typical or expected results.

You hold a long from an entry of 1000 on a made-up symbol. You set **How a reversal is detected** to **Moving averages cross against you**, **Look back this many candles** to 3, **Minimum candles held** to 2 and **Minimum profit to close (%)** to 1.

| Candle after entry | Close | Moving averages | What happens |
| - | - | - | - |
| 1 | 1010 | Fast above slow | The trade has been open one candle, below the minimum of 2. The rule does not look. |
| 2 | 1030 | Fast above slow | The rule looks. No cross. |
| 3 | 1000 | Fast crosses below slow | A reversal is seen. Profit at this close is 0 percent, below the 1 percent you asked for. Nothing happens. |
| 4 | 1020 | Fast still below slow, no new cross | The cross on candle 3 is inside the look-back of three candles, so it still counts. Profit is 2 percent, which meets the minimum. The bot closes the long at market. |

With **Look back this many candles** set to 1, the cross on candle 3 would have been missed. On candle 4 the rule would only have looked at that one candle, where nothing crossed.

![Four candles after a long entry at 1000, with a fast and a slow moving average. The fast average crosses below the slow one on candle 3, where profit is below the minimum so nothing happens. On candle 4 the cross is still inside the look-back window and profit meets the minimum, so the trade closes.](https://mintcdn.com/vole-bot/FPSL8V4NlLCcmRfn/images/pro-exit/close-on-a-trend-reversal.svg?fit=max\&auto=format\&n=FPSL8V4NlLCcmRfn\&q=85\&s=7514fa6b211354cdc116331f8274dbd2)

A cross on candle 3 is still counted on candle 4 because of the look-back. Made-up numbers.

## Good to know

* Only whole, closed candles count. The rule never acts on a candle that is still forming.
* A reversal that is seen but blocked by **Minimum profit to close (%)** is not forgotten. For the moving-average cross, it stays eligible while it is inside the look-back.
* The closed trade shows the reason **Trend Reversal**.
* It only closes trades. It never opens one and never moves your stop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.