OPEN-SOURCE SCRIPT

Uptrick: Flow Expansion Trend

3 632
Introduction
Uptrick: Flow Expansion Trend (FET) is an overlay tool built around an efficiency-adaptive midline that speeds up or slows down based on how directional recent price movement has been. The midline is paired with a volatility-based signal boundary and a minimum flow-strength filter to determine confirmed trend flips, and the script includes a market-state read that classifies current conditions as directional, developing, or compressed. Signal labels can be anchored to price highs and lows, a fixed ATR distance from price, or the midline itself.

Originality
This script's core is an efficiency ratio, calculated as the net price movement over a lookback divided by the sum of all bar-to-bar movement over that same lookback, which produces a value between 0 and 1 describing how directional versus choppy the recent path has been. Rather than using this ratio as a standalone oscillator, it is fed into the smoothing constant of the midline itself, so the midline's responsiveness continuously adjusts between a fast and slow smoothing constant based on current market efficiency. This is what separates the midline from a standard moving average, since it does not use a fixed lookback response but instead reshapes itself with the character of the move.

The signal boundary distance around the midline is also adaptive: it widens or narrows based on the same efficiency reading, so the distance price must travel to trigger a trend flip contracts in efficient, directional conditions and expands in choppier ones. A trend flip additionally requires a minimum flow-strength threshold, a normalized measure of the midline's own rate of change relative to ATR, so a boundary breach alone is not sufficient to flip the trend without accompanying follow-through in the midline's slope.

Combining an adaptive midline, an adaptive signal boundary, and a flow-strength confirmation filter into a single confirmed-trend mechanism is the original contribution of this script, since each of the three components is derived from the same efficiency and volatility inputs but serves a distinct role in preventing premature or noise-driven flips. The selectable signal anchor further separates the trend calculation from the signal display, letting traders choose whether labels sit at the bar's high/low, a fixed ATR offset from price, or directly on the midline, without altering the underlying trend logic in any way.

Features
  • Efficiency-adaptive midline that adjusts its smoothing speed based on how directional recent price action has been
  • Adaptive signal boundary that widens in choppy conditions and narrows in directional conditions
  • Minimum flow-strength filter required alongside a boundary breach to confirm a trend flip
  • Confirmed-bar trend state calculation to avoid intrabar repainting of the trend flip
  • Selectable signal anchor for up and down labels: high/low, fixed ATR distance from price, or midline
  • Adjustable ATR distance value when the ATR distance anchor is selected
  • Up and down trend signal labels
  • Optional candle coloring based on the most recent confirmed signal
  • Adjustable midline width
  • On-chart dashboard showing trend, market efficiency percentage, flow strength, market state classification, bars since the last signal, and current signal anchor mode
  • Four selectable dashboard positions
  • Four alert conditions: up signal, down signal, any trend signal, and market becoming directional

Inputs
  • Trend Engine: source, trend length, signal distance multiplier, minimum signal strength threshold.
  • Signals: show/hide up and down signals, signal anchor mode, signal ATR distance.
  • Visuals: candle coloring toggle, midline width, show/hide dashboard, dashboard position.

How It Works / How to Use
The script measures how efficiently price has moved over the trend length by comparing net displacement to total path length traveled. This efficiency value continuously reshapes the midline's smoothing speed, so the midline hugs price more closely in strong directional runs and lags more in choppy conditions. An ATR-based boundary is placed around the midline, with its distance also scaled by the same efficiency reading. A trend flip is confirmed only when price closes beyond this boundary on a confirmed bar and the midline's own rate of change exceeds the minimum flow-strength threshold in that direction.

Once a flip is confirmed, the up or down label is placed according to the chosen signal anchor: at the bar's high or low, at a fixed ATR distance beyond price, or directly on the midline. This is purely a display choice and does not affect when or why a trend flip occurs.
Traders can use the midline's slope and color for ongoing directional bias, the up and down signals for confirmed flips, and the dashboard's market-state classification to gauge whether current conditions are more suited to trend-following or more likely to produce choppy, range-bound behavior.

Conclusion
Uptrick: Flow Expansion Trend combines an efficiency-adaptive midline, a matching adaptive signal boundary, and a flow-strength confirmation filter into a single trend-following overlay, giving traders a trend read that reshapes itself with current market conditions rather than relying on a fixed-speed average, with flexible signal placement to suit different charting preferences.

Disclaimer
This script is provided for informational and educational purposes only and does not constitute financial advice. Past performance, whether shown historically or implied through the script's logic, does not guarantee future results. Always perform your own due diligence and risk management before making trading decisions.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.