OPEN-SOURCE SCRIPT

Smart Trend [Zofesu]

1 188
Smart Trend [Zofesu] is an ATR-based trend following indicator extended with two original filtering layers not present in standard Supertrend implementations: a Hull Moving Average macro trend filter and a Volume Percentile Rank confirmation system.

The ATR trailing stop concept is well established in technical analysis. The original additions in this script are the dual-filter architecture and how the three layers interact to produce signals only when all conditions align.

─────────────────────────────────────
01 — What is Smart Trend?
─────────────────────────────────────
Smart Trend [Zofesu] plots a dynamic trend line based on ATR volatility. The line trails price and flips direction when price breaks through it with volume confirmation. Two additional filters gate the signals — ensuring entries align with both macro trend direction and institutional volume participation.

The result is fewer but higher-quality signals compared to a standard ATR trailing stop.

─────────────────────────────────────
02 — Three-Layer Architecture
─────────────────────────────────────
Layer 1 — ATR Trend Engine (Core)
The trend line is calculated using ATR × multiplier applied to high/low. It trails in the direction of the trend and flips only when price closes on the opposite side with confirmation.

Upper band = high - (ATR × multiplier) — support in uptrend
Lower band = low + (ATR × multiplier) — resistance in downtrend

The trend line locks at the highest support or lowest resistance seen during the trend — it only moves in the direction of the trend, never against it.

Layer 2 — HMA Macro Filter (Original)
A Hull Moving Average with a long smoothing period (default 500) acts as a macro trend filter. When enabled, signals are only shown when the ATR trend direction agrees with the HMA macro direction. Conflicting signals (ATR bullish but price below HMA) are shown in gray — indicating low-confidence state.

This filter is the key difference from a standard Supertrend. It eliminates counter-trend entries in strongly trending markets.

Layer 3 — Volume Percentile Rank (Original)
A trend flip requires not just a price break but also a volume confirmation. Volume is ranked as a percentile over 500 bars. A flip only occurs if current volume rank exceeds the configured threshold (default 40th percentile).

This prevents trend flips on low-volume, potentially false breakouts.

─────────────────────────────────────
03 — Settings
─────────────────────────────────────
ATR Period — default 25
Lookback for ATR calculation. Higher = smoother trend line, less reactive.

Volatility Multiplier — default 3.2
Controls band width. Higher = fewer flips, stays in trend longer. Lower = more reactive, more signals.

Enable Main Trend Filter — default on
When on, signals require HMA macro trend agreement. When off, raw ATR signals only.

Main Trend Smoothness (HMA) — default 500
HMA length for macro trend. Higher = slower macro trend, fewer conflicting signals filtered out.

Show Background Bias Tint — default on
Green background = macro trend bullish. Red = macro trend bearish. Gray = conflicting state.

Require Volume Confirmation — default on
When on, trend flips require volume rank above threshold.

Volume Percentile Rank — default 40
Minimum volume percentile required for a trend flip. 40 = volume must be in top 60% of last 500 bars.

─────────────────────────────────────
04 — Signal Colors
─────────────────────────────────────
🟢 Teal line — ATR trend bullish, confirmed by HMA filter
🔴 Red line — ATR trend bearish, confirmed by HMA filter
⚫ Gray line — ATR trend direction conflicts with HMA macro trend — low confidence, avoid trading

BUY label — trend flipped bullish with all filters aligned
SELL label — trend flipped bearish with all filters aligned

─────────────────────────────────────
05 — How To Use
─────────────────────────────────────
Step 1 — Check background color
Green tint = macro trend bullish, look for longs only.
Red tint = macro trend bearish, look for shorts only.

Step 2 — Wait for trend line flip
BUY label = trend flipped to bullish with volume confirmation.
SELL label = trend flipped to bearish with volume confirmation.

Step 3 — Check line color
Teal or Red = high confidence signal (all filters aligned).
Gray = skip — ATR and HMA disagree.

Step 4 — Alerts
Two alert conditions are pre-configured:
Smart Trend: BUY Signal
Smart Trend: SELL Signal

─────────────────────────────────────
06 — Best Timeframes
─────────────────────────────────────
H1, H4 and D1 produce the most reliable signals with default settings.
On lower timeframes consider reducing the ATR Period to 14 and Volume Percentile to 30.
On higher timeframes (W1) consider increasing the ATR Period to 34+.

Works on all asset classes: Indices, Forex, Gold, Oil, Crypto.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。