Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / HalfTrend

HalfTrend, explained from the source

HalfTrend by everget is one of the most-boosted trend lines on TradingView: a blue or red stepped line, a shaded ATR ribbon, and Buy and Sell labels where it changes colour. It looks like a Supertrend or a Chandelier Exit, and most people assume the ATR drives it. The published source shows otherwise. The line and every Buy and Sell label come from recent highs, lows and closes only. The ATR draws the ribbon and places the arrows, and nothing else. So of the two settings, only one changes the signals.

The two settings

The line: a ratchet built from highs and lows

While the line is blue (up), the script keeps track of the highest "recent low" since the last flip, where a recent low is the lowest low of the last Amplitude bars. The line takes that value and never moves down while it stays blue.

While the line is red (down), it mirrors this: it tracks the lowest "recent high" since the last flip and never moves up.

When the colour changes, the new line starts from where the old one was on the previous bar, so the line has no gap at a flip.

The flip rule

A blue line turns red on the first bar where both of these hold:

A red line turns blue on the mirror: the average of the last Amplitude lows is above the lowest recent high, and the close is above the previous bar's high.

There is no ATR anywhere in that rule. The Buy label prints on the bar the line turns blue, and Sell on the bar it turns red. The arrows and labels are drawn at the edge of the ATR ribbon, which is why they sit at a tidy distance from price; that distance is decoration.

What the settings change

Channel Deviation changes no signals. Raising it from 2 to 5 makes the ribbon wider and nothing else: every flip, every label and every alert stays on the same bar. Many "best settings" guides tune it as if it filtered signals.

Amplitude is the only setting that matters. A longer look-back needs a bigger turn before the averages cross back, so it flips later and less often. On random-walk prices (our simulation, 200,000 bars):

Amplitudeflip everyflipped back within 5 barsmove from extreme close to flip
2 (default)16 bars16%2.6 bar ranges, 5 bars later
321 bars6%3.1 bar ranges, 7 bars later
530 barsunder 1%3.9 bar ranges, 10 bars later
1049 barsnone5.1 bar ranges, 16 bars later

Fewer labels that reverse quickly, and later labels, are the same setting seen from two sides. Random-walk prices have nothing to predict, so these numbers describe how the rule reacts to noise, not how it trades.

Does HalfTrend repaint?

On closed bars, no: the line and the labels use only the current and past bars, and nothing is plotted with an offset. On the bar still forming, the high, low and close are live, so a label can appear mid-bar and vanish before the close. Set alerts to "once per bar close" if you only want closed-bar labels. More in what repainting is, or test a script with the repaint checker.

HalfTrend vs Supertrend and Chandelier Exit

Supertrend and Chandelier Exit place their line a multiple of ATR away from price, so volatility sets how far price must turn. HalfTrend's line sits on actual recent lows or highs, and its flip needs the bar averages to cross that line plus a close beyond the previous bar. There is no volatility multiple to widen or narrow, so the size of turn it needs is set by the bars themselves and by Amplitude.

Where it fails

Also explained: Chandelier Exit · Supertrend · UT Bot Alerts · Repainting

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. HalfTrend is by everget on TradingView; this page explains its published open-source code and is not affiliated with the author.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Subscribe to the Teardown Letter: $19/moBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.