# Donchian Trend Rules

Donchian Trend Rules is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Runs the mechanical Donchian breakout system: long on a break of the prior 20-bar high, exit on the prior 10-bar low, mirrored for shorts, with close or intrabar triggers and one-sided or reversing direction modes. Plots the entry channel, a trailing exit level, and sequenced markers (one entry per trade) for systematic trend followers.

- Indicator in the LuxAlgo Library, by LuxAlgo, published May 29, 2026.
- Access: free.
- Concepts: [Donchian Trend Rules](https://www.luxalgo.com/library/concept/donchian-trend-rules/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=aahr9vr6942c9kbhze5z7ba8
- Page: https://www.luxalgo.com/library/indicator/donchian-trend-rules/

**Donchian Trend Rules** runs the mechanical breakout system on the chart: long on a break of the prior 20-bar high, out on a break of the prior 10-bar low, mirrored for shorts, all sequenced through an explicit position state. The clean build of the [Donchian trend rules](https://www.luxalgo.com/library/concept/donchian-trend-rules/), it draws the entry channel with a gradient fill, trails the exit level with the open position, and prints one entry marker per trade. Nothing reprints until its exit.

## How to Trade the Donchian Trend Rules?

- **Long Entry triangle**: the trigger cleared the prior entry-channel high; the mirrored breakdown opens shorts.
- **Trailing Exit Level**: the opposite extreme of the exit channel. Its break closes the trade, and the line doubles as a standalone trailing stop.
- **Direct reversals**: in Long & Short mode an opposite entry signal flips the position without waiting for the exit rule.
- **Regime as filter**: the +1 / 0 / -1 position state (and optional bar coloring) can filter entries from other tools.

Setting the exit equal to the entry recreates the always-in four-week rule; expect frequent small whipsaws in ranges in exchange for the occasional long ride.

## Donchian Trend Rules Settings

- **Entry Length** (default 20): lookback of the entry channel; a breakout beyond a band opens a position.
- **Exit Length** (default 10): lookback of the exit channel. A shorter window gives back less of the move when it reverses.
- **Breakout Trigger** (default Close): a close beyond the band, or Intrabar Touch as soon as a wick penetrates it.
- **Trade Direction** (default Long & Short): both sides with direct reversals, or one-sided modes that go flat on the exit rule.
- **Show Entry Channel**, **Show Trailing Exit Level**, **Show Signal Markers** (all enabled), and **Color Bars by Regime** (disabled) select the display.

## Frequently Asked Questions

### How does this differ from plain Donchian Channels?

[Donchian Channels](https://www.luxalgo.com/library/indicator/donchian-channels/) draw the levels; this build trades them. It adds asymmetric entry/exit lookbacks, a state machine sequencing one entry per trade, the trailing exit plot, and direction modes: the system rather than the geometry.

### Why did a touch of the band not open a trade?

The default Breakout Trigger is Close, so a wick through the band does nothing; the channels are also built from prior bars only, so a bar never breaks a level it is itself creating. Switch to Intrabar Touch for the faster convention.

### Which lengths should I use?

20/10 and 55/20 are the documented pairings (tactical and campaign), and the defaults give the first. A longer entry demands more proof, a shorter exit protects more open profit, and equal lengths produce a stop-and-reverse system.

## Related indicators

- [SuperTrend AI (Clustering)](https://www.luxalgo.com/library/indicator/supertrend-ai-clustering/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/supertrend-ai-clustering.md
- [KNN Supertrend Horizon](https://www.luxalgo.com/library/indicator/knn-supertrend-horizon/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/knn-supertrend-horizon.md
- [Supertrend Parameter Sensitivity 3D](https://www.luxalgo.com/library/indicator/supertrend-parameter-sensitivity-3d/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/supertrend-parameter-sensitivity-3d.md
- [SuperTrend Recovery](https://www.luxalgo.com/library/indicator/supertrend-recovery/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/supertrend-recovery.md
- [Evasive SuperTrend](https://www.luxalgo.com/library/indicator/evasive-supertrend/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/evasive-supertrend.md
- [Gann HiLo Activator](https://www.luxalgo.com/library/indicator/gann-hilo-activator/) (Trend): markdown at https://www.luxalgo.com/library/indicator/gann-hilo-activator.md
- [Trend Magic](https://www.luxalgo.com/library/indicator/trend-magic/) (Trend): markdown at https://www.luxalgo.com/library/indicator/trend-magic.md
- [SuperIchi](https://www.luxalgo.com/library/indicator/superichi/) (Supertrend): markdown at https://www.luxalgo.com/library/indicator/superichi.md

---

Source: https://www.luxalgo.com/library/indicator/donchian-trend-rules/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
