Concept
Trend Magic
Trend Magic is a Trend concept. The Library holds 1 implementation — a working definition you can pull into Quant.
Top Trend Magic indicator
The top custom implementation, built on the original standard Trend Magic formula.
1 total
This Trend Magic implementation is strategy-ready: open it in Quant, set your rules, and it backtests automatically.
What is Trend Magic?
Trend Magic is a trailing trend line that takes its direction from momentum rather than from price alone. It computes a CCI and an ATR: while the CCI is at or above zero the line is drawn below price (typically the low minus an ATR-based offset) and only ratchets upward; when the CCI drops below zero the line jumps above price (high plus the offset) and only ratchets downward. The line's color flips with the CCI's sign, giving a two-state long/short regime.
That construction places it in the same family as Supertrend and other stop-and-reverse trailers, with one distinction: the flip is decided by the oscillator crossing zero, not by price piercing the band, while ATR only sets the line's distance from price. Like every trailing regime tool it trends well and chops badly; sideways markets produce clusters of false flips that no parameter choice fully removes.
The ratchet is the construction's heart. In the bullish state each bar proposes a line at the low minus the ATR offset, and the plotted value is the higher of that proposal and yesterday's line, so the floor rises or holds but never retreats; the bearish state mirrors this with a ceiling that only descends. When the CCI's sign finally flips, the line does not travel to the other side, it is recomputed there, which is why flips print a visible jump. KivancOzbilgic's port is the canonical version on the platform, with a CCI length near 20 and the ATR offset as the two exposed inputs.
The design's descendants address its known weakness. AlphaTrend, from the same author, rebuilds the idea with an ATR-band construction gated by a money-flow condition instead of a raw CCI sign, explicitly to cut the range-chop flipping that Trend Magic inherits from its zero-cross trigger. The practical mitigation inside Trend Magic itself is external: pair the line with a regularity or slope filter so flips only count when the broader regime read agrees, and let the ratchet do what it does best, trail risk under an established move.
How to identify Trend Magic's states
Two inputs, two states, one ratchet: the whole tool is readable from its construction.
- 1Compute the CCI, commonly around 20 periods; its sign is the sole flip authority.
- 2Compute the ATR offset that sets how far the line trails from price.
- 3In the bullish state (CCI at or above zero), plot the higher of low-minus-offset and the prior line: a floor that only rises.
- 4In the bearish state (CCI below zero), plot the lower of high-plus-offset and the prior line: a ceiling that only falls.
- 5Read color flips as regime transitions and the gap between price and line as the trend's current risk buffer, remembering flips bunch together in ranges.
How traders use it
- As a regime filter: long setups are taken only while the line sits below price in its bullish state, shorts only in the opposite state, with other tools handling entries.
- As a trailing stop reference: the ratchet never gives ground within a trend, so the line (or a buffer beyond it) serves as an exit level that tightens as the move extends.
- As a flip-signal generator: color changes mark state transitions, usually traded only with confirmation because flips bunch together in ranges.
- As the exit engine for external entries: entries come from structure, patterns or momentum, while Trend Magic's ratcheting line manages the position, a division of labor that sidesteps its weak flip timing.
- In multi-timeframe stacks: a higher-timeframe Trend Magic supplies the permitted direction while the trading timeframe handles execution, so range chop on the lower frame cannot flip the governing bias.
Trend Magic vs related trailing tools
Supertrend: Both trail an ATR-offset line and hold state until flipped, but Supertrend flips when price crosses the band while Trend Magic flips when its CCI crosses zero. The momentum trigger can lead or lag the price trigger at turns, and the two disagree exactly where turn-timing matters.
EMA: An EMA is a continuous line that bends through every fluctuation; Trend Magic is a stateful ratchet that refuses to retreat within a regime. The EMA gives graded, always-on information, the ratchet gives a binary regime plus a hard risk line, two different jobs often run side by side.
MA Slope Filter: Both produce a binary trend gate. The slope filter derives it from an average's direction, changing gradually; Trend Magic derives it from an oscillator's sign, changing instantly at the zero cross. The instant flip is sharper in trends and noisier in chop, which is the whole trade.
Concept family
Trend
100 concepts mapped · 100 in the Library
Trend Magic FAQ
How is Trend Magic different from Supertrend?
Both draw an ATR-offset line that trails price and flips between long and short states. Supertrend flips when price itself crosses the band; Trend Magic flips when its CCI crosses zero, with ATR only setting the line's distance from price. In practice the two often agree in trends and disagree at turns, where the CCI condition can trigger earlier or later than a price cross.
What are the best settings for Trend Magic?
There is no single best. Ports differ in their CCI lookback and ATR settings, and every combination faces the same trade-off: shorter inputs flip sooner and whipsaw more, longer inputs lag turns. Settings that look ideal on one symbol and timeframe rarely transfer unchanged, so test on the market you trade and expect false flips in ranges regardless.
Can Trend Magic be used as a trailing stop?
That is arguably its best role. The ratchet guarantees the line never loosens within a regime, so it behaves like a disciplined trailing stop that tightens as the trend extends. Most users exit on a close beyond the line or place stops a small buffer past it to survive wick noise, and accept that the CCI flip, not the stop logic, decides when the regime itself has ended.
Why does the line jump when it flips?
Because the two states are computed from opposite sides of price. The bullish line ratchets up from lows minus the offset; the moment the CCI turns negative, the calculation restarts from highs plus the offset, which sits a full band's width away. The jump is the construction working as designed, not an error, and it is also why flip-chasing entries in ranges pay the spread twice.
What is AlphaTrend and how does it relate?
AlphaTrend is KivancOzbilgic's follow-up design, built explicitly to tame the range-flipping that Trend Magic inherits from its raw zero-cross trigger. It constructs ATR-based bands and gates direction with a money-flow or momentum threshold rather than a bare CCI sign, producing a steadier line in chop. The two share the trailing-regime philosophy; the successor spends more machinery on the transition problem.
Does Trend Magic work on all timeframes?
The construction computes anywhere, and its personality is consistent: rewarding in markets and timeframes that trend cleanly, expensive in those that range. Lower timeframes amplify the chop problem since ranges dominate more of the tape; higher timeframes suit the ratchet's patience. The robust deployments either climb a timeframe, add a regime filter in front of the flips, or restrict the tool to exit duty.
Turn Trend Magic into a trading strategy.
Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it with AI.
