Adaptive Fibonacci Trailing System [WillyAlgoTrader]🚀 Adaptive Fibonacci Trailing System (AFT) is a premium overlay toolkit that combines a regime-aware adaptive trailing stop, a dynamic Fibonacci premium/discount cloud, a 6-factor confidence grading engine, full SL/TP risk management with break-even logic, and a built-in backtest tracker — all in one indicator. Every signal arrives with a clear direction, a confidence grade (A+ / A / B / C), a recommended position size, and pre-placed stop-loss and three take-profit levels.
This is not a static trailing stop. This is not another Fibonacci retracement tool you have to draw by hand. This is a complete trade-management system that automatically detects market structure, classifies the current regime (Trending / Ranging / Volatile), adapts its stop placement to the conditions, scores every setup from 0 to 100%, and tracks every closed trade so you can see whether your settings actually work on your market.
🎯 WHO THIS IS FOR
— Trend traders who want a structural trailing stop that adapts to volatility instead of trailing a fixed percentage
— Swing traders who need clean Buy/Sell signals with pre-calculated SL, TP1, TP2, TP3
— Day traders and scalpers who need fast regime detection so they don't trade trend signals in a ranging market
— Discretionary traders who want a confidence score to filter low-quality setups
— Systematic traders who want JSON webhook alerts for automation
— Anyone tired of generic Fibonacci tools that ignore market context
— Traders who want a built-in backtest tracker to validate the system on their own market and timeframe
💎 WHY TRADERS CHOOSE THIS INDICATOR
✅ Adaptive trailing stop — not a fixed ATR multiple.
The trailing stop is anchored to Fibonacci levels of the most recent swing range and adjusts itself based on the detected regime. In trending markets it widens to let winners run. In ranging markets it tightens to exit fast. In volatile markets it sits at the midpoint. You don't choose a static distance — the indicator chooses the right distance for current conditions.
✅ Built-in market regime detection.
Every bar is classified as Trending , Ranging , or Volatile using ADX and a volatility ratio (current ATR vs. 50-bar average). Hysteresis is applied so the regime doesn't flicker on borderline values. You always know what kind of market you're in before you take the trade.
✅ Dynamic Fibonacci cloud.
A premium/discount zone is drawn live between the 0.382 and 0.618 levels of the current swing structure. The cloud re-anchors automatically every time the structure changes — no manual drawing, no stale levels from last week. Three visual styles available: Gradient, Solid, or Pulsing (brightens when price approaches the 0.5 inflection point).
✅ Two signal modes for two trader styles.
Trail Flip mode fires signals only when the adaptive trail flips direction — fewer signals, strong trend conviction. 0.5 Cross mode fires when price crosses the Fibonacci 0.5 (premium/discount inflection) with full triple-confirmation — earlier entries, more signals. The 0.5 Cross mode also has three strictness levels (Strict / Relaxed / None) so you can dial signal frequency to match your style.
✅ 6-factor confidence score on every signal.
Every Buy/Sell signal comes with a percentage score and a letter grade. Grades range from D (poor) to A+ (premium setup). The score combines structure strength, regime alignment, ADX strength, volume, volatility favorability, and Fibonacci/SMA50 confluence — weighted into a single number you can filter on. Set a minimum confidence threshold and weak signals are blocked automatically.
✅ Adaptive position sizing.
Set your base risk per trade once. The indicator scales it by signal grade: C grade gets 0.5× base, B grade 0.75×, A grade 1.0×, A+ grade 1.5×. You take small positions on average setups and larger positions on premium setups — automatically. Recommended risk % is shown live in the dashboard.
✅ Full risk management with one-click presets.
Choose Conservative, Balanced, Aggressive, Scalping, or Custom. Every Buy/Sell signal automatically draws Entry, SL, TP1, TP2, TP3 lines on the chart with price and percent-from-entry labels. Lines extend forward and update live until the trade closes.
✅ Break-even trail after TP1.
When TP1 is hit, the stop-loss automatically moves to entry. Your remaining position becomes risk-free. The original SL line dims to show it's no longer active, and the entry label updates to "→ SL (BE)" so you always know where the real stop is.
✅ Built-in backtest tracker — per-grade.
Every closed trade is tracked: total trades, wins, losses, win rate, average R, profit factor, total R. Then it's broken down by confidence grade so you can see whether A+ signals actually outperform B signals on your market. If they don't, you know to retune. The tracker auto-resets when you change critical inputs so old stats never pollute new tests.
✅ Triple-confirmation breakout filter.
Direction changes require body ratio + ATR-based penetration + regime gate. No more wick-based fakeouts triggering position flips. You can dial the strictness for both modes independently.
✅ Universal — works on every market and timeframe.
Forex, crypto, stocks, futures, indices. Scalping (1m, 5m), intraday (15m, 1h), swing (4h, 1D), position (1W). The structure engine adapts to whatever pivot length you set. Volume is auto-detected and gracefully ignored on FX where it's unreliable.
✅ Professional dashboard with full live state.
At a glance: Regime, ADX, Volatility ratio, Signal mode, Confidence + grade, Suggested risk %, Direction, Trail Stop price, Timeframe, full SL/TP/RR/Risk block, and a complete Backtest section with per-grade breakdown.
✅ Alerts in plain text or JSON for webhooks.
Buy / Sell / SL hit / TP1, TP2, TP3 hit / Break-even activated. JSON payload includes ticker, timeframe, price, SL, all three TPs, R:R, regime, mode, confidence, grade, and recommended risk % — ready to feed any automation pipeline.
🚀 HOW IT CHANGES YOUR WORKFLOW
Before: You draw Fibonacci retracements by hand on every swing. You guess where to place the stop — fixed ATR multiple, recent low, gut feel. You take signals in any market without checking if it's trending or ranging. You have no idea whether your "best" setups actually win more often. You miss break-even opportunities and watch winners turn into losers. You manage three TPs in your head and forget which one was already hit.
After: You add the indicator. The Fibonacci cloud is already drawn — re-anchored to the current swing automatically. The dashboard tells you the regime, the signal grade, and the recommended risk % before you click Buy. SL, TP1, TP2, TP3 are pre-placed and labeled with prices and percentages. When TP1 hits, your stop is moved to entry without you touching anything. Every closed trade is logged and broken down by grade. After 50 trades, you know exactly which signal mode and confidence threshold work on your market.
What used to take 5 minutes of manual setup per trade now takes 5 seconds — read the dashboard, decide.
📖 HOW TO USE
🎯 Quick start (for beginners):
1. Add the indicator to your chart (any market, any timeframe).
2. Look at the dashboard in the top-right corner. It tells you the regime (Trending / Ranging / Volatile), the current confidence score, and the suggested risk %.
3. Wait for a "▲ Long " or "▼ Short " label to appear under or above a candle. The grade letter (C, B, A, A+) tells you the quality of the signal.
4. The indicator automatically draws Entry, SL, TP1, TP2, TP3 lines on the right side of the chart with prices and percentages.
5. Place your trade with the suggested risk % from the dashboard. Use the SL and TP levels exactly as drawn.
6. When TP1 hits (line turns cyan with a ✓), your SL automatically moves to entry — your trade is now risk-free. Let it run to TP2 and TP3.
7. The Backtest panel at the bottom of the dashboard tracks every closed trade. Watch your stats grow.
👁️ Reading the chart:
— 🟢 Green "▲ Long " label = Buy signal with grade letter
— 🔴 Red "▼ Short " label = Sell signal with grade letter
— 🟡 The colored cloud between two Fib lines = the current premium/discount zone
— The middle dotted line (Fib 0.5) = the inflection between premium and discount
— Solid colored line that follows price = the adaptive trailing stop (green when long, red when short)
— Blue dotted line = your entry price
— Red solid line = your stop-loss
— Green dashed lines (3 of them) = TP1, TP2, TP3
— When a TP is hit, its line turns cyan and the label gets a ✓ check mark
— When break-even activates, the SL line dims and the entry label becomes amber with "→ SL (BE)"
📊 Dashboard fields:
— Regime : current market state (Trending, Ranging, Volatile)
— ADX : trend strength number
— Vol Ratio : how volatile the market is right now (1.0 = average)
— Signal : which signal mode is active and its strictness
— Confidence : the score and grade of the most recent / pending signal
— Sugg. Risk : the recommended position size as % of account
— Direction : current trail direction (Bullish / Bearish / Flat)
— Trail Stop : the live trailing stop price
— TF : your current timeframe
— SL / TP1 / TP2 / TP3 : active trade levels (BE @ price when break-even is on)
— R:R : risk-to-reward ratio at TP1
— Risk : distance from entry to SL as % of price
— Backtest section : Trades, Win Rate, Avg R, Profit Factor, Total R
— By Grade : same stats broken down by A+ / A / B / C / D
💡 Trading ideas:
— Trend-follower setup : Use Trail Flip mode + Conservative risk preset on 1H or 4H. Take only A and A+ signals. Let trades run to TP3.
— Premium/discount swing setup : Use 0.5 Cross + Strict + Balanced risk on 15m or 1H. The 0.5 cross catches reversals at the Fibonacci inflection point.
— Scalping setup : Use 0.5 Cross + Relaxed + Scalping preset on 1m or 5m. Lower the minimum confidence to 50%. Exit at TP1 or TP2.
— Confirmation overlay : Run AFT alongside your existing system. Only take your trades when AFT confidence shows B or higher in the same direction.
— Beginner-safe mode : Set minimum confidence to 75 (A grade or above). Use Conservative risk preset. Let break-even handle most management.
— Backtest-then-trade workflow : Toggle Reset Backtest, scroll the chart back, let the indicator collect 30+ trades, check the per-grade stats, then start trading the grades that perform best.
🔧 Tuning guide:
— Too many signals? Increase Min Confidence (try 60 or 75), or switch from "None" to "Strict" cross strictness, or use Trail Flip mode.
— Too few signals? Lower Min Confidence (try 40 or 50), or set strictness to "Relaxed" or "None".
— Stop too tight? Switch trailing mode from Aggressive to Balanced or Conservative, or pick the Conservative risk preset.
— Stop too wide? Switch to Aggressive trailing mode or Aggressive / Scalping risk preset.
— Whipsaw on ranging markets? Increase Breakout Confirmation to 0.3 or 0.5, raise Min Body Ratio to 0.6.
— Want only premium setups? Set Min Confidence to 90 (A+ only). Expect 1-3 signals per week on most markets.
⚙️ KEY FEATURES
🏛️ Structure Engine:
— Score-filtered swing detection (every swing is rated by ATR-normalized impulse and volume)
— Adjustable pivot length (3 to 50 bars)
— Memory of the last 5 swings for stable Fibonacci anchoring
— Optional swing labels showing the score number
📡 Market Regime Engine:
— ADX-based trend detection with adjustable threshold
— Volatility ratio (current ATR vs. 50-bar average) for volatile-state detection
— Hysteresis on both thresholds — no regime flicker
— Optional background highlight for 10 bars after each regime change
🎯 Trailing Stop Engine:
— 4 modes: Aggressive (tight), Balanced, Conservative (wide), Adaptive (auto-adjusts to regime)
— Volatility-inverse adjustment: tighter in low vol, wider in high vol
— Direction-locked update: longs only lift the stop, shorts only lower it
— Triple-confirmation breakout filter (body ratio + ATR penetration + regime gate)
🌀 Fibonacci Cloud:
— Auto-anchored to the latest valid swing high/low
— 3 visual styles: Gradient, Solid, Pulsing
— Optional confluence markers when a Fib level aligns with SMA50
— Toggleable Fib level lines (0.382 / 0.5 / 0.618)
🛡️ Risk Management:
— 5 presets: Conservative, Balanced, Aggressive, Scalping, Custom
— ATR-based stop sizing with adjustable multiplier
— Three take-profit levels with adjustable risk-multiples
— Break-even trail toggle (moves SL to entry on TP1 hit)
— Live SL/TP lines with price + percent-from-entry labels
— Position lock: new signals are blocked while a trade is active
🎓 Confidence & Sizing Engine:
— 6-factor scoring (structure / regime / ADX / volume / volatility / confluence)
— 5 grades: D / C / B / A / A+
— Minimum confidence filter (0–100%) blocks weak signals
— Adaptive position sizing toggle scales risk by grade
— Adjustable base risk % per trade
📈 Backtest Tracker:
— Tracks every closed trade (closed by SL or TP3)
— Win/loss outcome model with TP1/TP2/TP3 partial-success recognition
— Win rate, average R, profit factor, total R
— Per-grade breakdown (validate the confidence engine on your market)
— Auto-reset on critical input changes
🎨 Visual System:
— Auto / Dark / Light theme detection
— Configurable label and dashboard font sizes
— Compact Pro-style design — no chart clutter
— Optional WillyAlgoTrader watermark
🔔 Alert System:
— Buy / Sell signals with full payload
— SL Hit, TP1/TP2/TP3 Hit, Break-even Activated
— Plain text or JSON webhook format
— Bar-close confirmed (no repainting)
📊 Dashboard:
— 5 position options (corners + middle right)
— 3 font sizes
— Adapts to your visible feature set (collapses sections that aren't enabled)
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All signals fire only on confirmed bar close. Pivots use equal left/right lookback (the swing point is in the past by N bars — this is delayed confirmation, not repainting). Alerts use alert.freq_once_per_bar_close.
— 📐 The trailing stop and Fibonacci anchors require at least two opposing swings in memory. Fresh charts and new symbols need a brief warm-up period (typically 50 bars).
— 📐 On markets with no reliable volume data (most FX pairs), the volume-confirmation factor is replaced by a neutral default. The indicator works fully on FX.
— ⚖️ The backtest tracker counts only confirmed closures (SL hit or TP3 hit). Partial profits at TP1/TP2 are recognized in the win/loss outcome but realize at the level reached when the trade ultimately closes. Real-trading slippage, spread, and fees are not modeled.
— ⚖️ The confidence score is a quantitative filter, not a prediction of profit. It reflects setup quality based on the inputs available — not future performance.
— 🛠️ This is an analysis and trade-management tool, not an automated trading bot. It detects structure, classifies regime, scores setups, places SL/TP levels, and tracks outcomes — trade decisions remain yours .
— 🌐 Universal compatibility — works on all markets (Forex, crypto, stocks, futures, indices) and all timeframes from 1m to 1M.
Pine Script® indicator






















