OPEN-SOURCE SCRIPT
已更新 TrendSurfer Pro

TrendSurfer Pro 🚀
TrendSurfer Pro is a multi-layer trading system built around a core principle: a signal is only valid when multiple independent methods agree. Each component serves a specific, non-redundant role in filtering market noise and identifying high-probability setups.
🧠 How the Components Work Together
The indicator is organized in three layers:
Layer 1 — Trend Context (background conditions)
All signals require alignment with the broader trend before firing. Three independent trend filters run simultaneously:
EMA 750 — long-term directional bias. Bullish signals fire only above it, bearish only below.
Butterworth Filter (2/3-pole) — a zero-lag smoothed trend line that reacts faster than a standard EMA without the noise of raw price. It filters signals that are against the smoothed short-term direction.
VIDYA (Variable Index Dynamic Average) — adapts its smoothing speed to market momentum using a CMO-based efficiency ratio. It is more reactive during trending phases and slower during choppy markets.
These three together define the structural bias. No entry signal fires against all three.
Layer 2 — Entry Signals (timing)
Five signal types identify precise entry points, each using a different market mechanic:
-Master Trend (△▽) — triggers on EMA 4/5 crossover confirmed by RSI > 50 (bull) or < 50 (bear), with price above/below EMA 21, 50, 55, 89, and 750. Engulfing candles on the signal bar are highlighted separately (green/red) to indicate stronger momentum.
-KCandle / Boost (⠾⠻) — detects full engulfing candles where the current bar completely covers the prior bar's range, filtered by EMA 750 side. These identify momentum shifts at key levels and optionally project a "golden area" retracement zone.
-Triangle Signals (▲▼) — fire when the Butterworth Filter changes direction, price is on the correct side of EMA 750 and EMA 25, Stochastic K > 50 (bull) or < 50 (bear), and volume ratio exceeds the threshold. Volume is scaled 1–10 and displayed as a label on the signal bar.
-Order Block Rejections (🟩🟥) — identifies impulsive candles using Z-Score of price change (deviation from SMA of recent changes). When price re-enters the zone of the last opposing candle before the impulse and shows a rejection wick with body outside the zone, a signal fires.
-Liquidity Sweep (✕) — detects when price spikes beyond a pivot high/low (user-defined swing length) and closes back inside. Confirms smart money stop-hunting activity. Also available as a master filter: restrict all other signals to fire only within N bars after a sweep.
Layer 3 — Exit Signals
Take Profit System (🎯) — combines up to 8 indicators (RSI, MACD, Stochastic, Bollinger Bands, Supertrend, CCI, EMA cross, Price Action breakout). A TP signal fires only when the user-defined minimum number of confirmations are met simultaneously (default: 5 of 8). Bearish TP fires above price, bullish below.
Session Rejections (⚡ M) — after a Tokyo, London, or New York session box is drawn, price that breaks above/below the session high/low and then re-enters triggers an External Rejection (⚡). Price that touches and rejects off the session midline triggers an "M" label.
EMA 750 / BF / VIDYA Rejections (R 🟡 🟢🔴) — candles whose wick touches the respective line but whose body remains on the correct side fire a labeled rejection signal. These mark precise dynamic support/resistance touches.
🗂️ Filters
VWAP Filter — restricts signals to the correct side of the daily VWAP
ATR Volatility Score — scores current volatility 1–100 relative to a moving average of ATR. Optionally filter signals below a minimum score.
ATR Channel Mode — creates a dynamic channel around EMA 750 using a long-period ATR multiplier. Signals outside the channel are suppressed.
Yellow Box Filter — isolated stochastic-neutral candles (K between 48–52, not preceded or followed by another neutral candle) generate a yellow rectangle. Signals and KCandle lines are optionally restricted to appear only near these zones.
Time Filters (1/2/3) — three independent session time ranges. Signals fire only within the active windows.
📊 Dashboard Table
The top-right table shows in real time:
EMA 4 vs 5 direction, RSI level, price vs EMA 21/50/55/89/750
Time filter status and active sessions
Buy/Sell volume delta since last VIDYA trend change
ATR value and Vol Score
Overall trend state (VERY BULLISH / BULLISH / BEARISH / VERY BEARISH)
⚙️ How to Use
Set your timezone offset so session boxes align correctly with Tokyo (02:00–08:00 UTC), London (08:00–14:00 UTC), New York (14:00–02:00 UTC).
Choose which master filters to enable (EMA 750, BF, VWAP) based on your timeframe. On lower timeframes (1–5 min), all three recommended. On higher timeframes, BF filter alone may suffice.
Enable the Liquidity Sweep Master Filter if you want to trade only reactive moves after liquidity grabs. Set "Max bars after Sweep" to 3–5 for tight timing.
Use the TP System as an exit confirmation, not an entry. A 🎯 above price after a long entry is the exit signal.
Yellow Box Filter is most useful on 1–5 min charts to avoid trading in random mid-range areas.
Volume label color on Triangle signals: white = standard, orange = high volume (≥9), green = high volume AND price near VWAP — the highest-quality setup.
🔔 Alerts
All signal types have individual alert toggles. Alerts fire once_per_bar_close to avoid repainting. Available alerts: Triangle ▲▼, KCandle, Master Trend, OB Rejection, EMA750/BF/VIDYA Rejection, Session External/Midline Rejection, Liquidity Sweep, TP Bull/Bear, ATR Vol Score.
TrendSurfer Pro is a multi-layer trading system built around a core principle: a signal is only valid when multiple independent methods agree. Each component serves a specific, non-redundant role in filtering market noise and identifying high-probability setups.
🧠 How the Components Work Together
The indicator is organized in three layers:
Layer 1 — Trend Context (background conditions)
All signals require alignment with the broader trend before firing. Three independent trend filters run simultaneously:
EMA 750 — long-term directional bias. Bullish signals fire only above it, bearish only below.
Butterworth Filter (2/3-pole) — a zero-lag smoothed trend line that reacts faster than a standard EMA without the noise of raw price. It filters signals that are against the smoothed short-term direction.
VIDYA (Variable Index Dynamic Average) — adapts its smoothing speed to market momentum using a CMO-based efficiency ratio. It is more reactive during trending phases and slower during choppy markets.
These three together define the structural bias. No entry signal fires against all three.
Layer 2 — Entry Signals (timing)
Five signal types identify precise entry points, each using a different market mechanic:
-Master Trend (△▽) — triggers on EMA 4/5 crossover confirmed by RSI > 50 (bull) or < 50 (bear), with price above/below EMA 21, 50, 55, 89, and 750. Engulfing candles on the signal bar are highlighted separately (green/red) to indicate stronger momentum.
-KCandle / Boost (⠾⠻) — detects full engulfing candles where the current bar completely covers the prior bar's range, filtered by EMA 750 side. These identify momentum shifts at key levels and optionally project a "golden area" retracement zone.
-Triangle Signals (▲▼) — fire when the Butterworth Filter changes direction, price is on the correct side of EMA 750 and EMA 25, Stochastic K > 50 (bull) or < 50 (bear), and volume ratio exceeds the threshold. Volume is scaled 1–10 and displayed as a label on the signal bar.
-Order Block Rejections (🟩🟥) — identifies impulsive candles using Z-Score of price change (deviation from SMA of recent changes). When price re-enters the zone of the last opposing candle before the impulse and shows a rejection wick with body outside the zone, a signal fires.
-Liquidity Sweep (✕) — detects when price spikes beyond a pivot high/low (user-defined swing length) and closes back inside. Confirms smart money stop-hunting activity. Also available as a master filter: restrict all other signals to fire only within N bars after a sweep.
Layer 3 — Exit Signals
Take Profit System (🎯) — combines up to 8 indicators (RSI, MACD, Stochastic, Bollinger Bands, Supertrend, CCI, EMA cross, Price Action breakout). A TP signal fires only when the user-defined minimum number of confirmations are met simultaneously (default: 5 of 8). Bearish TP fires above price, bullish below.
Session Rejections (⚡ M) — after a Tokyo, London, or New York session box is drawn, price that breaks above/below the session high/low and then re-enters triggers an External Rejection (⚡). Price that touches and rejects off the session midline triggers an "M" label.
EMA 750 / BF / VIDYA Rejections (R 🟡 🟢🔴) — candles whose wick touches the respective line but whose body remains on the correct side fire a labeled rejection signal. These mark precise dynamic support/resistance touches.
🗂️ Filters
VWAP Filter — restricts signals to the correct side of the daily VWAP
ATR Volatility Score — scores current volatility 1–100 relative to a moving average of ATR. Optionally filter signals below a minimum score.
ATR Channel Mode — creates a dynamic channel around EMA 750 using a long-period ATR multiplier. Signals outside the channel are suppressed.
Yellow Box Filter — isolated stochastic-neutral candles (K between 48–52, not preceded or followed by another neutral candle) generate a yellow rectangle. Signals and KCandle lines are optionally restricted to appear only near these zones.
Time Filters (1/2/3) — three independent session time ranges. Signals fire only within the active windows.
📊 Dashboard Table
The top-right table shows in real time:
EMA 4 vs 5 direction, RSI level, price vs EMA 21/50/55/89/750
Time filter status and active sessions
Buy/Sell volume delta since last VIDYA trend change
ATR value and Vol Score
Overall trend state (VERY BULLISH / BULLISH / BEARISH / VERY BEARISH)
⚙️ How to Use
Set your timezone offset so session boxes align correctly with Tokyo (02:00–08:00 UTC), London (08:00–14:00 UTC), New York (14:00–02:00 UTC).
Choose which master filters to enable (EMA 750, BF, VWAP) based on your timeframe. On lower timeframes (1–5 min), all three recommended. On higher timeframes, BF filter alone may suffice.
Enable the Liquidity Sweep Master Filter if you want to trade only reactive moves after liquidity grabs. Set "Max bars after Sweep" to 3–5 for tight timing.
Use the TP System as an exit confirmation, not an entry. A 🎯 above price after a long entry is the exit signal.
Yellow Box Filter is most useful on 1–5 min charts to avoid trading in random mid-range areas.
Volume label color on Triangle signals: white = standard, orange = high volume (≥9), green = high volume AND price near VWAP — the highest-quality setup.
🔔 Alerts
All signal types have individual alert toggles. Alerts fire once_per_bar_close to avoid repainting. Available alerts: Triangle ▲▼, KCandle, Master Trend, OB Rejection, EMA750/BF/VIDYA Rejection, Session External/Midline Rejection, Liquidity Sweep, TP Bull/Bear, ATR Vol Score.
版本注释
New features added to TrendSurfer Pro v7.6 🚀📋 Last Signal Table (bottom-right)
A new real-time table displays the last 3 alerts fired on the chart. Each row shows the signal name and the exact time it occurred (HH:mm:ss, respecting your UTC offset). Signals auto-scroll FIFO style — the newest always on top, pushing older ones down. Bull signals appear in green 🟢, bear signals in red 🔴, fading progressively for older entries. Toggle and text size are controlled from the Master Trend settings group.
🎯 TP Sequential Labels
Every Take Profit signal now shows a white label with progressive numbering: TP1, TP2, TP3... for consecutive signals in the same direction. As soon as a signal in the opposite direction appears, the counter resets back to TP1. Bull TP labels appear above the bar 📈, bear TP labels below 📉.
版本注释
Here's a summary of all changes made to TrendSurfer Pro v.7.7 🚀:💧 Sweep RR System — New Feature
Integrated the full RR trade visualization from the Sweep Entry Calculator directly into TrendSurfer Pro
TP/SL boxes now open automatically on every existing Liquidity Sweep signal (the 🔵/🟠 X crosses)
TP target uses the previous swing high/low in the opposite direction (natural target), with fallback to custom RR
Swing TP dashed line points correctly to the TP level
Breakeven, Overlap Trades, Pip Labels, and Swing Line toggles included
📊 Liquidity Sweep Stats Table — New (bottom-left)
Tracks trades, win rate, win pips, loss pips and net difference
TF1 / TF2 / TF3 (with time ranges in parentheses)
Best Time Filter highlight in gold ⭐
Avg RR display, live pips on open trades
版本注释
Here's a summary of all changes made to TrendSurfer Pro v7.7:📐 Resizable Sweep Stats Table
Added Sweep Table Text Size 📏 input in the 💧 Sweep RR System group (default: small)
📐 Resizable Last Signal Table
Added Last Signal Table Text Size 📏 input in the Master Trend group (default: small)
🔀 Overlap indicator in Sweep Table
When Overlap Trades is enabled, 🔀 appears in the parameter row of the Sweep Stats table
🎯 TP Alert with sequence number
Dynamic alerts now include the TP count in the message (e.g. 🎯 TAKE PROFIT 7 BULLISH, 🎯 TAKE PROFIT 15 BEARISH)
📅 Previous Day High / Low / Close lines
Added PDH (green), PDL (red) and PDC (white) horizontal lines with customizable colors, labels and toggle per level. Levels fetched via request.security for accuracy on all timeframes
🔔 PD Levels Touch Alert
Alert fired once per bar close when price touches PDH, PDL or PDC, with message in English (e.g. 🔺 PREV DAY HIGH TOUCHED: 1.23456)
版本注释
Bug Fix.版本注释
Removed OFF-Filter from Liquidity Sweep Sats Table版本注释
Here's a brief summary of today's changes:⚙️ Sweep RR System input group moved above Triangles Signals Settings for better UI organization.
🔒 ATR Mode filter extended to Liquidity Sweep signals — bullish sweeps now blocked above upper band, bearish below lower band.
版本注释
🔧 Fix: Session Lines Extension — Universal Timeframe SupportReplaced the hardcoded switch block (which only handled 1m, 5m, 15m, 30m, 60m, D) with a dynamic calculation using timeframe.in_seconds(). Session extension bars are now computed as round(extensionMinutes × 60 / tf_seconds), making Tokyo 💴, London 💶 and New York 💵 session lines visible on any timeframe ⏱️, including 2m, 3m, 4m, 45m and beyond ✅.
版本注释
🔁 Trailing Stop System — New Feature📌 Two new inputs added to the Sweep RR System settings:
Trailing Stop Start at RR — defines at which Risk:Reward level the trailing activates
Trailing Stop Step (pips) — defines how many pips the SL trails behind the price
⚙️ How it works:
The trailing activates independently, regardless of whether Breakeven is enabled or not
Once the price reaches the trigger level, the SL starts following the price step by step
The SL can only move in a favorable direction, never against the trade
🎨 Visual improvements when Trailing Stop is hit:
The original SL and TP boxes become invisible
A gray box appears from the original SL to the entry price
A green box appears between entry price and trailing level — representing the actual profit
A gray box appears from the trailing level to the original TP — representing the unreached portion
📊 Statistics are now correct:
Trailing stop hit in profit → counted as a win ✅
Trailing stop hit at breakeven → counted as 0 pips 🔒
Trailing stop hit in loss → counted as a loss ❌
🏷️ Label update: when the trailing stop moves, the SL label changes from BE 🔒 to TS 🔒
📋 Table update: the Sweep Stats table now shows the trailing stop status — TS: 2.5R / 5.0 pips when active, or TS: OFF when disabled
版本注释
New Version 7.8. Here's a summary of all changes made in this session:
📊 Sweep Stats Table
Column "Diff" renamed to "Diff / R"
Win Pips column now shows pips + total R won (e.g. 3526 /+14.50R)
Loss Pips column now shows pips + total R lost (e.g. 1200 /-3.00R)
Diff column now shows pips difference + R difference (e.g. +2326 /+11.50R)
R values are calculated as the sum of actual R per trade (wins and losses separately, BE excluded)
🏷️ Chart Labels
Entry label: grey background, white text, direction triangle (▲/▼) moved to end of text
Live P&L label: follows current price bar by bar, green if in profit / red if in loss, shows current pips and R (e.g. +350.0 pips / +3.50R)
TP/SL labels: now show R alongside pips (e.g. TP +500.0 pips / +5.00R, SL -100.0 pips / -1.00R), and follow the right edge of the chart bar by bar while trade is open
🔔 Alerts
All signal alerts now include closing price at the end (e.g. VIDYA BEARISH REJECTION at 1.23456)
Sweep TP/Trail/SL alerts now include both pips and R (e.g. SWEEP TP HIT ✅ +350.0 pips / +5.00R)
Sweep Bull/Bear signal alerts reformatted (e.g. 🔵 Bullish Liquidity Sweep at 1.23456)
Signals updated with closing price: Master Trend, Master Trend Rejection, Session External Rejection, Session Midline Rejection, EMA750 Rejection, Butterworth Rejection, VIDYA Rejection, OB Rejection, Take Profit, Up/Down Triangle, KCandle, Yellow Candle, ATR Volatility Score
版本注释
v7.81 Update 🚀✅ Neutral Trend Label — Added "NEUTRAL ⚖️" status to the Master Trend Table. It now correctly displays when indicators are mixed (neither all bullish nor all bearish), making trend reading more accurate and complete.
🎨 Master Trend Bar Color — Added a second bar coloring mode that paints candles based on the current trend status: 🟢 green for Very Bullish conditions, 🔴 red for Very Bearish conditions, keeping the chart clean and instantly readable at a glance.
版本注释
New Version 8.82 -Minor Bug Fix
版本注释
v8.83 — Changelog🔧 Bug Fix — Historical Buffer Error
Fixed a runtime crash on high-density charts (e.g. FESX1! M1) caused by entry label bar_index references exceeding Pine Script's historical buffer limit. All signalBar references in label updates are now clamped to bar_index - 6000.
👁️ New Toggle — Entry Label Visibility
Added Show Entry Label toggle in the Sweep RR System settings. Allows hiding the grey entry price label on the chart while keeping TP/SL labels visible.
版本注释
TrendSurfer Pro 🚀 — v7.84 ChangelogSweep RR System ⚙️
🏷️ Added emoji to "Show Entry Label" input title
🟢🔴 Added colored emojis to "Show TP/SL Pip Labels" input title
💹 Added new Show Live P&L Label toggle — when enabled, a live label updates pips and R in real time while the trade is open; when disabled, no label is created at all
📝 Added bilingual EN/IT tooltips to both "Show Entry Label" and "Show Live P&L Label" inputs
Master Trend Table 📊
🖼️ Added frame to the Master Trend Table border
🟢 Table frame turns bright green when status is VERY BULLISH
🔴 Table frame turns bright red when status is VERY BEARISH
⬜ Table frame defaults to dark grey in all other states (Neutral, Bullish, Bearish)
版本注释
TrendSurfer Pro v.7.85 — Changelog 🚀🎨 Bar Colors (candleColor)
🔵 Bullish candle transparency: 70 → 50 (more intense cyan)
🔴 Bearish candle transparency: 70 → 50 (more intense red)
🎨 Master Trend Bar Colors (inputs)
🟢 mtBarColorBull: transparency 30 → 10 (much more intense green)
🔴 mtBarColorBear: transparency 30 → 10 (much more intense red)
⚫ mtBarColorNeutral: transparency 50 → 30 (more visible gray)
📊 Master Trend Table — "Current Trend" logic (complete rewrite)
❌ Removed broken logic that blocked BULLISH/BEARISH from ever appearing
✅ VERY BULLISH 🚀 — all 7 indicators green
✅ VERY BEARISH 💀 — all 7 indicators red
✅ BULLISH 📈 — price above EMA750 and above VIDYA
✅ BEARISH 📉 — price below EMA750 and below VIDYA
✅ NEUTRAL ⚖️ — all other cases
🔢 Table frame color — softened transparency for bull/bear border (50 alpha added)
📈 Min Volatility Score default: 75 → 80
版本注释
TrendSurfer Pro v7.86 🔢 New: Volume Strength 1-10 module
A brand-new, fully independent feature that prints a 1-10 strength label on candles based on volume — separate from the existing 🔺/🔻 triangle signal system, so the two never collide.
🚫 Smart overlap protection
A dedicated "Hide Label on Triangle Signal Bars" toggle automatically suppresses the new label whenever an existing Up/Down Triangle fires on the same bar — zero visual clutter.
📈 EMA-aware filtering
Optional EMA750 trend filter for the new labels, with the choice to reuse TSP's existing Master EMA750 (no duplicate plot) or set a custom period.
🎚️ Independent volume filter
Its own Single/Range volume filter (1-10), separate from the triangle signals' filter (6-10) — configure each system on its own terms.
版本注释
TrendSurfer Pro 🚀 — Changelog v7.87🔢 Volume Strength 1-10 now respects Time Filters
The Volume Strength labels (1-10) plotted on every candle are now filtered by Time Filter 1, 2 and 3, just like all other signals on the chart.
👉 Labels will only appear when at least one enabled time filter is active.
🔔 New Alert: "Volume Strength 1-10"
Added a brand new alert condition, fully independent from the triangle signals alert system:
🆕 New toggle: Enable Volume Strength 1-10 Alert 🔢
📣 Fires whenever a Volume Strength label is displayed (respects volume filter, EMA trend filter, time filter, and the "hide on signal bars" option)
💬 Alert message includes the volume strength value (1-10) and the trigger price.
版本注释
TrendSurfer Pro 🚀 v7.88 💧 Liquidity Sweep Master Filter — now also filters Volume Strength labels and Session Rejections
📊 Volatility Score Master Filter — now also filters Volume Strength labels and Session Rejections
📐 ATR Mode — now also filters Volume Strength labels and Session Rejections (direction-aware: bullish checks upper band, bearish checks lower band)
🔔 Alert message improvement
🔢 Volume Strength alerts now include a directional triangle just like the Volatility Score alerts:
▲ Bullish Candle Close
▼ Bearish Candle Close
版本注释
TrendSurfer Pro 🚀 — v7.89 Changelog📊 Master Trend Table riorganizzata
🗑️ Rimossa la riga ATR(14)
➕ Aggiunta la riga ATR Mode con stato ON/OFF e valore del moltiplicatore
🔀 Nuovo ordine dei 3 Master Filter nella tabella: Liq.Sweep Master Filter → Volat.Score Master Filter → ATR Mode
🎯 Segnali Take Profit (TP) più leggibili
📏 Le etichette "TP1", "TP2"... non usano più la distanza basata sul range della singola candela (high - low), causa di sovrapposizioni o spazi eccessivi
✅ Ora la distanza è calcolata come multiplo dell'ATR(14), tramite il nuovo input "TP Label Distance (x ATR)" (default 0.5) — resta costante su qualsiasi candela o livello di zoom
版本注释
TrendSurfer Pro v7.90 — Changelog 🚀🔄 Master Trend Rejection
Now triggers even when the candle closes the "wrong" color, as long as the wick spike stays contained within the Master Trend line and the close remains on the correct side — no longer requires a matching bull/bear candle body.
💹 Live P&L Label (Sweep RR System)
Fixed label overlap when Overlap Trades is enabled with multiple simultaneous trades — each trade now gets its own vertical slot so all live P&L labels stay readable at once.
🎯 TP Hit / SL Hit / Breakeven / Trailing Labels
Same anti-overlap fix extended to the labels shown when a trade closes (TP hit, SL hit, Breakeven, Trailing Stop) — no more stacked unreadable text when multiple trades close on the same bar.
⚠️ Take Profit System — New EMA750 Anomaly Detection
New visual warning: if a Bullish TP signal fires while price is still below EMA750, a white downward triangle replaces the usual green dot.
If a Bearish TP signal fires while price is still above EMA750, a white upward triangle replaces the usual red dot.
All other cases keep the original dot markers unchanged.
🔔 TP Alerts — EMA750 Context
TP Bullish/Bearish alert messages now append "(below EMA750)" or "(above EMA750)" when the anomaly condition is detected, giving instant context without opening the chart.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。