Uptrick: Adaptive Trend Matrix

5 086
Introduction
Uptrick Adaptive Trend Matrix is a trend-following overlay that combines a volatility-based ratcheting trail with a ten-factor confirmation score. The trail defines where the current trend would be considered broken, while the confirmation score decides whether that break is supported by enough independent market evidence to flip the trend and print a Buy or Sell signal. Once a signal prints, the script projects three ATR-based take-profit levels and marks the bar on which each level is reached. The aim is to give traders one clean view of the current trend direction, trend changes that are backed by broad agreement across different types of indicators, and objective profit-taking reference points.

Originality
Most trailing-stop trend tools flip direction the moment price closes through the trail. Most multi-indicator dashboards, on the other hand, display a score without tying it to any price structure. Adaptive Trend Matrix links the two. The trail is never allowed to flip on price alone. A trend change requires three conditions on the same confirmed bar:
  • Price closes through the opposing trail.
  • Price also closes on the new side of the smoothed trend basis.
  • At least a user-defined number of the ten confirmations agree with the new direction.

If price breaks the trail but the confirmation count is below the threshold, the trend stays unchanged and no signal is printed. In other words, the confluence score acts as a gate on the trail, not as a separate panel the trader has to interpret on their own.

The ten confirmations were selected so they measure different characteristics of the market instead of repeating the same information:
  • Trend structure: EMA 12 versus EMA 34, and DMI direction filtered by a minimum ADX.
  • Momentum: RSI, MACD, Stochastic, CCI and Rate of Change.
  • Volume and participation: MFI, OBV relative to its own EMA, and price relative to VWAP.

Because a signal needs agreement across these groups, a break that is supported only by short-term momentum, but not by structure or volume, may not reach the threshold and is then ignored. Several confirmations use neutral buffer zones (RSI and MFI must be above 52 or below 48, and the Stochastic must be above 45 or below 55) so that readings sitting near their midpoint do not count toward either side.

The trail is built from a double-smoothed EMA of hlc3 and a smoothed ATR. The bullish and bearish trails are both calculated on every bar and ratchet in their own direction. This means the opposing trail is always available as the break level for the next signal, even while the current trend is active.

Features
  • Bullish trail that ratchets upward only and resets to the current basis-minus-ATR level when price closes below it.
  • Bearish trail that ratchets downward only and resets to the current basis-plus-ATR level when price closes above it.
  • Double-smoothed EMA basis on hlc3 used as the trend centerline and as an additional break condition.
  • Smoothed ATR used for trail distance, signal placement, take-profit distances and marker offsets.
  • Ten-factor confirmation matrix scored separately for the bullish and the bearish side, from 0 to 10.
  • Adjustable confirmation threshold from 4 to 10.
  • Minimum ADX filter that decides whether the DMI confirmation is allowed to count.
  • Neutral buffer zones on RSI, MFI and Stochastic to avoid counting midpoint readings.
  • Confirmation-gated trend state: trail color and candle color only change when a qualifying signal occurs.
  • Buy and Sell labels evaluated on confirmed bar closes only.
  • Strict signal alternation: a Buy can only follow a Sell and vice versa, with no repeated signals in the same direction.
  • Signal labels placed at an adjustable ATR offset beyond the trail.
  • Signal label tooltip showing how many of the ten confirmations were present on the signal bar.
  • Three take-profit levels calculated from the signal bar's close and ATR.
  • Take-profit levels locked at entry and reset only by the next opposite signal.
  • X markers printed once per take-profit level on the first confirmed bar after the signal that reaches it.
  • Adjustable offset that places TP X markers clear of the candles.
  • Trend-colored candles.
  • Vertical gradient between trail and price, strongest at the trail and fading toward price.
  • Display trail clamped so it always stays at least one tick on the trend side of price.
  • Bull and bear confirmation counts shown in the Data Window on every bar.
  • Five alert conditions: Buy, Sell, TP1, TP2 and TP3.
  • Fully adjustable colors, transparency and visibility for every visual element.


Inputs
Appearance
  • Bullish Color (default #00FFE5): color for the bullish trail, candles, gradient and Buy labels.
  • Bearish Color (default #FF00B5): color for the bearish trail, candles, gradient and Sell labels.
  • Buy Text (default black): text color of Buy labels.
  • Sell Text (default white): text color of Sell labels.
  • TP X Color (default white): color of the take-profit X markers.

Trend Engine
  • Trend Length (default 16): EMA length of the hlc3 basis. Lower values react faster, higher values produce longer trend regimes.
  • Smoothing (default 3): additional EMA smoothing applied to both the basis and the ATR.
  • ATR Length (default 10): ATR period that controls how quickly volatility adapts.
  • Trail Distance (default 1.8): ATR multiplier for the distance between basis and trail. Lower values allow quicker trend switches, higher values produce smoother trends.

Signals
  • Show Buy / Sell (default on): shows or hides the signal labels.
  • Required Confirmations (default 6, range 4 to 10): minimum number of agreeing confirmations needed for a signal. 6 is balanced, 7 to 8 is stricter.
  • Minimum ADX (default 15): minimum ADX value required for the DMI confirmation to count.
  • Signal Trail Offset (default 0.5): ATR distance between the trail and the signal label. Buy labels sit below the trail, Sell labels above it.

Take Profits
  • Show TP Xs (default on): shows or hides the take-profit markers.
  • TP1 Distance (default 1.0): TP1 distance from entry in ATR.
  • TP2 Distance (default 2.0): TP2 distance from entry in ATR.
  • TP3 Distance (default 3.25): TP3 distance from entry in ATR.
  • TP X Offset (default 2.0): ATR distance of the X marker above the high (longs) or below the low (shorts).

Display
  • Vertical Gradient (default on): shows or hides the gradient between trail and price.
  • Trend Candles (default on): shows or hides trend-colored candles.
  • Gradient At Trail (default 72): gradient transparency at the trail. The gradient fades to fully transparent at price.
  • Trail Transparency (default 30): transparency of the trail line.


How It Works
1. Basis and volatility
An EMA of hlc3 is calculated with the Trend Length, then smoothed again with the Smoothing length. ATR is calculated with the ATR Length and smoothed the same way.

2. Trails
The bullish candidate level is the basis minus ATR multiplied by Trail Distance, and the bearish candidate level is the basis plus the same distance. The bullish trail keeps the highest candidate value over time and the bearish trail keeps the lowest. When price closes beyond a trail, that trail resets to the current candidate level.

3. Confirmation matrix
On every bar each of the ten confirmations is checked for bullish and bearish conditions:
  • EMA: EMA 12 above or below EMA 34.
  • RSI (14): above 52 or below 48.
  • MACD (12, 26, 9): MACD line above signal with a positive histogram, or below signal with a negative histogram.
  • Stochastic (14, 3): %K above %D and above 45, or below %D and below 55.
  • CCI (20, hlc3): above or below zero.
  • DMI (14, 14): +DI above -DI, or -DI above +DI, with ADX at or above the minimum.
  • ROC (10): above or below zero.
  • MFI (14): above 52 or below 48.
  • OBV: above or below its 14-period EMA.
  • VWAP: close above or below the session VWAP.

Each condition that is true adds one point to its side, giving a bullish score and a bearish score between 0 and 10.

4. Signals
A Buy prints on a confirmed bar when the current trend is bearish, the close is above both the bearish trail and the basis, and the bullish score meets the Required Confirmations. A Sell prints under the mirrored conditions. A signal flips the trend state, which switches the active trail, candle color and gradient.

5. Take profits
On each signal the close and ATR of that bar are stored, and three levels are calculated at the chosen ATR distances in the trade direction. From the next bar onward, each level is checked once on confirmed bars. When a level is reached, an X is printed on that bar. The X is placed at an ATR offset beyond the bar's high or low for visibility, so it marks the bar on which the level was reached, not the exact price of the level.

How to Use
  • Read the trail and candle color as the current trend bias. The trend only changes on a printed signal.
  • Treat Buy and Sell labels as confirmed trend changes. Hover over a label to see how many confirmations supported it.
  • Use the opposing trail as a reference for where the current trend would be challenged.
  • Use the TP X markers as reference points for scaling out or tightening risk. They do not track any open position after an opposite signal.
  • Raise Required Confirmations or Trail Distance for fewer, more selective signals. Lower them for faster reactions.
  • Check the Data Window to see how many confirmations each side currently has, even when no signal prints.
  • Set alerts with the frequency Once Per Bar Close, since all signals and TP events are evaluated on confirmed bars.
  • The OBV, MFI and VWAP confirmations rely on the chart's volume data. On symbols without volume data, these confirmations cannot contribute, so a lower Required Confirmations value may be needed.
  • Use the script on standard candlestick or bar charts. Signals on Heikin Ashi, Renko, Kagi, Point and Figure or Range charts are based on synthetic prices and do not reflect real tradable prices.
  • Signals and take-profit markers do not repaint once a bar has closed. No future data or plot offsets are used.


Conclusion
Uptrick Adaptive Trend Matrix ties a volatility-adaptive trailing structure to a ten-factor confirmation score, so that trend changes require both a structural price break and broad agreement across trend, momentum and volume measures. Combined with fixed ATR-based take-profit reference levels, confirmation counts in the Data Window and alerts for every event, it gives traders a structured way to follow trends, judge the strength behind each signal and plan exits. All thresholds are adjustable, so the balance between responsiveness and selectivity can be tuned to the trader's market and timeframe.

Disclaimer
This script is provided for educational and informational purposes only and does not constitute financial advice. Trading involves substantial risk, and past performance does not guarantee future results. Signals and take-profit levels are based on historical price and volume calculations and can fail in any market condition. Always do your own research, test thoroughly and use proper risk management before making trading decisions.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.