Halftrend
By LuxAlgoMay 8, 2026
Halftrend rebuilds the community-bred Halftrend trail as one stepped line with two states. While up, the line follows the running floor of the lowest lows over the amplitude window beneath price; while down, the running ceiling of the highest highs above it. A flip requires the averaged highs (or lows) to cross the tracked level, confirmed by a close past the prior bar's extreme, and the line carries unchanged through the flip bar, staying continuous where jump-style trails gap. A channel sized from half the ATR wraps the line as a tolerance zone, and a vertical gradient fills the span between price and the line.
How to Trade the Halftrend?
- Bullish flip arrow: the state turned up — the line now trails beneath price and gates long exposure.
- Bearish flip arrow: the mirror event, the line stepping down overhead.
- Flat line: the amplitude window has produced no fresh extreme — the trend is paused, not broken, and a stop referenced to the line has held.
- Channel rejection: a wick into the channel that closes back outside it reads as continuation pressure in the standing state's direction.
In tight ranges arrows alternate quickly — flips are state changes, not automatic trades.
Halftrend Settings
- Amplitude (default 2): lookback of the extreme tracking and the flip-driving averages; larger values hold stiller lines but concede more at turns.
- Channel Deviation (default 2.0): multiplier on half the ATR that sizes the tolerance channel.
- ATR Length (default 100): a long averaging window, so the channel breathes slowly.
- Signal On Bar Close (default disabled): fire arrows and alerts only once the bar closes, removing intrabar provisionality.
- Style toggles: the ATR channel, flip arrows and gradient trail fill are on by default; line width defaults to 2.
Frequently Asked Questions
How does Halftrend differ from Supertrend?
Both are stop-and-reverse trails, but Supertrend holds its line an ATR-scaled distance from price, adjusting continuously with volatility, while Halftrend moves only when its amplitude window prints a new extreme. The cost is lag at genuine turns, where Halftrend waits for its crossing condition.
Do wicks into the channel threaten the trend state?
No — the channel is there to absorb them. A poke into it is expected behavior; this build only treats a wick that closes back outside the channel as an event, firing the channel rejection alerts.
When should Signal On Bar Close be enabled?
When acting on live alerts: a flip condition that appears mid-bar and vanishes by the close never signals, so each printed arrow is final. Historical bars are unaffected — every historical close is already confirmed.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
