TL;DR. A stop a fixed number of ATRs (the key value) from the close. While the close stays on one side, the stop only tightens; when the close crosses it, the stop jumps to the other side. A buy is the close crossing above the stop, a sell the close crossing below.
What it measures
- A volatility-sized stop. The distance from the close is the key value times Wilder's ATR, so the stop widens in fast markets and tightens in quiet ones.
- The trend's side. Direction is 1 while the close is above the stop and -1 while it is below.
- The moment the side changes. The signal output marks each cross of the stop.
Formula
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Key Value | 1 | 0.1 to 20 | How many ATRs the stop sits from the close. Small values hug price, large ones ride out pullbacks. |
| ATR Period | 10 | 1 to 500 | Bars in Wilder's ATR. |
| Heikin-Ashi Close | Off | On, Off | On: the stop follows each bar's OHLC4. The ATR stays on the regular bars. |
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Stop | Numeric | Always | The trailing stop, in price units. |
| Direction | Numeric | On select | 1 while the anchor is above the stop, -1 while below. |
| Signal | Numeric | Always | +1 when the anchor crosses above the stop, -1 when it crosses below, 0 elsewhere. Drawn as markers on the chart. |
How to read it
- Close above a rising stop: an up state. The stop follows price up and never loosens.
- A buy (+1): the close has crossed above the stop; the stop has jumped below price. A sell (-1) is the mirror.
- Frequent flips: the key value is small for this market's noise. Each flip is a reversal, so many flips mean many losing round trips.
- Stop far from price: a large key value or a volatile stretch. Fewer flips, larger give-back on each.
Best in, worst in
Best in trending sessions, where a volatility-sized stop lets a trade run and the flip catches the turn.
Worst in tight ranges, where the close crosses a small stop back and forth. Raise the key value or gate it with a trend filter such as the Supertrend direction.
Three setups
1. Enter long on a buy flip
Wire Signal into a Comparison greater than 0 for the long Entry. Add the mirror (less than 0) for shorts if you want the strategy always in the market.
2. Exit on the opposite flip
Enter with any rule, then exit a long through Set Exit Condition when Signal is less than 0. The stop follows the trade and closes it when the close crosses back.
3. Filtered flips
AND the buy signal with a longer trend gate, for example the close above an EMA of 200 bars, so only flips in the direction of the larger trend trade.
Common mistakes
- Treating the stop as an intrabar stop. The cross is judged on the bar's close. A wick through the stop is not a flip.
- Comparing Direction when you mean a flip. Direction holds for many bars; Signal is the one-bar event.
- Tuning the key value to the history. A key value that works only at 1.3 is fitted to the test (overfitting in trading). Sweep a range and look for a plateau.
UT Bot is an ATR trailing stop on the close with its crosses marked: a trend side, an exit level and a flip event in one node.