HalfTrend โ a trend-following level that only moves against the trend once
the opposing side of the range genuinely gives way, so it holds flat through
noise where a moving average would wobble.
Two state machines run at once. trend is what is drawn; nextTrend is which
flip is currently armed. While a down-flip is armed the indicator tracks the
running maximum of the amplitude-bar low; the flip only fires when the mean
high drops under that maximum and the bar closes below the previous bar's
low. The up-flip is the mirror. Requiring both a mean crossing and a close
beyond the prior bar's extreme is what keeps the level still.
On a flip the new level starts from the level the other side ended on, which
is why the line steps rather than jumping to price. channelDeviation half-ATR
bands ride the level as a channel, and the flip bar is marked half an ATR
inside the channel.
Original implementation written from the algorithm's published behaviour, per
ARCHITECTURE.md ยง0.1 โ not ported from any third-party source.
HalfTrend โ a trend-following level that only moves against the trend once the opposing side of the range genuinely gives way, so it holds flat through noise where a moving average would wobble.
Two state machines run at once.
trendis what is drawn;nextTrendis which flip is currently armed. While a down-flip is armed the indicator tracks the running maximum of theamplitude-bar low; the flip only fires when the mean high drops under that maximum and the bar closes below the previous bar's low. The up-flip is the mirror. Requiring both a mean crossing and a close beyond the prior bar's extreme is what keeps the level still.On a flip the new level starts from the level the other side ended on, which is why the line steps rather than jumping to price.
channelDeviationhalf-ATR bands ride the level as a channel, and the flip bar is marked half an ATR inside the channel.Original implementation written from the algorithm's published behaviour, per ARCHITECTURE.md ยง0.1 โ not ported from any third-party source.