OPEN-SOURCE SCRIPT
Trend-Fib-Pivot Sweep [JopAlgo]

Trend-Fib-Pivot Sweep [JopAlgo] — trend rails + Fib touch rules + sweep logic
Core idea
This tool blends two trend MAs, a rolling Fibonacci grid, and pivot sweep tags so you can do three things quickly:
Trend → MA1 vs MA2 stack and slope
Location → Fib touch/bounce/reject rules
Triggers → sweep → reclaim or trend pullback → continuation
Use the MAs for bias, the Fib levels for where price should react, and the sweeps to spot traps and entries after liquidity grabs.
What you’ll see
MA 1 (default 21, purple) and MA 2 (default 50, gray)
Fib lines from the highest/lowest of your lookback: 0.236 (light blue), 0.382 (green), 0.5 (white), 0.618 (orange), 0.786 (red)
Sweep markers: triangle above = high sweep; triangle below = low sweep
Background: soft green when MA1 > MA2, soft red when MA1 < MA2
Read it fast → Trend (background + MA stack)? Which Fib are we near? Any sweep and reclaim?
How the Fib levels work (and what to do at each)
0.236 → shallow pullback in a strong trend
→ Expect quick bounce continuation.
→ If price closes through 0.236 and stalls, momentum may be cooling; look to 0.382.
0.382 → standard trend pullback
→ In a bullish trend, tests here often bounce and continue.
→ Entry idea: touch/bounce at 0.382 with MA1 above MA2 and rising, then a higher-low and push back above 0.382 → enter.
0.5 → midline / fair value
→ Often the “decision” level.
→ Clean continuation if 0.5 holds; deeper rotation if we accept below (for longs).
0.618 (“golden”) → deep pullback / last line for trend
→ Best risk-defined continuation entries come from rejects/reclaims here.
→ For longs: wick below 0.618, then reclaim 0.618 → long with stop under the sweep low.
0.786 → exhaustive pullback / trap zone
→ If trend is truly alive, 0.786 rejects and snaps back.
→ If we accept beyond 0.786 (closes), expect a full range rotation or trend change.
Touch/bounce rule of thumb
You want to see price interact: touch → reject (wick) → reclaim the level.
A close back above the Fib after a downside probe (or below after an upside probe) is a stronger confirmation than intrabar wicks.
What the MAs do (and how to use them)
MA1 (fast) vs MA2 (slow) define bias and momentum.
MA1 above MA2 and both rising (↗) → bullish regime.
MA1 below MA2 and both falling (↘) → bearish regime.
Flat / crossing often → balance; lean on sweeps and the deeper Fibs (0.5/0.618/0.786).
Interaction with Fibs
Highest quality: Fib level + MA confluence (e.g., 0.382 near MA1).
When MA1 = dynamic trigger: reclaim MA1 at a Fib → continuation signal.
When MA2 = last defense: lose MA2 at 0.5/0.618 → expect deeper rotation.
Sweep logic (why it matters and how to execute)
High sweep = current bar’s high takes out the recent high then fails → liquidity grab above.
Low sweep = current bar’s low takes the recent low then fails → liquidity grab below.
Execution idea
Longs: low sweep into 0.5/0.618/0.786, then reclaim the Fib and, ideally, MA1 → enter; stop under sweep low.
Shorts: high sweep into 0.5/0.382/0.236, then reclaim below the Fib and MA1 → enter; stop above sweep high.
Repaint note
If you enable Lag-Confirmed Pivot Mode, sweep labels are stricter and may “finalize” later (can appear as repaint).
For signals/alerts, prefer non-repaint mode; for review/training, lag-confirmed is fine.
How to trade it (simple playbook)
Direction filter (use MAs first)
Bullish bias → MA1 > MA2 and not flat → look for longs at 0.236/0.382/0.5.
Bearish bias → MA1 < MA2 → look for shorts at 0.236/0.382/0.5 from above.
Entries (two clean templates)
Trend pullback → continuation
→ In bull regime: price pulls to 0.382 or 0.5, shows rejection wick, then reclaims level and MA1 → enter long.
→ In bear regime: mirror with short from above.
Sweep → reclaim
→ Downside sweep through 0.618/0.786, then close back above the Fib and through MA1 → enter long.
→ Upside sweep through 0.382/0.236, then close back below and under MA1 → enter short.
Risk & targets
Stops → beyond the sweep extreme or below/above the reclaimed Fib (structure-based).
Targets → next Fib ladder (e.g., long from 0.5 → target 0.382 → 0.236), or obvious POC/HVNs if you use Volume Profile.
Settings that matter (and how to tune)
MA Types/Lengths
EMA (default fast) = responsive trend read.
SMA/HMA = smoother backbone.
21/50 is a solid default; swing traders can run 34/89.
Fib Lookback
Shorter lookback = tighter range, more sensitive levels;
Longer = broader swing map, fewer interactions but stronger signals.
Sweeps
Sweep Detection Range controls how “recent” the pivot must be (default 10).
Lag-Confirmed mode reduces false sweeps but can finalize later.
Starter presets
Intraday (15m–1H) → MA1 21 EMA, MA2 50 SMA, Fib lookback 100–150, Sweeps 10
Swing (4H) → MA1 34 EMA, MA2 89 SMA, Fib lookback 150–250, Sweeps 10–14
Pattern cheat sheet
0.382 kiss & go (trend day) → quick tag and bounce in bull regime → continuation.
0.5 decision → hold = trend resumes; failure = rotate to 0.618.
0.618 sweep + reclaim → high-quality continuation with tight risk.
0.786 trap → deep flush then snapback; if acceptance persists, expect full rotation.
MA pinch → break → MA1 and MA2 compress, then price breaks and holds a Fib → expansion leg.
Best combos (kept simple)
Volume Profile v3.2 [JopAlgo] → use VAH/VAL/POC/LVNs as concrete targets; look for Fib + VP confluence.
Anchored VWAP [JopAlgo] → reclaims/rejections at anchored lines with Fib reaction and MA agreement improve timing.
Common mistakes this helps you avoid
Buying into 0.618/0.786 without a reclaim (catching falling knives).
Fading a 0.236 pullback when MAs are strongly ↗ (fighting trend).
Taking sweeps without a reclaim/confirmation.
Ignoring the MA stack when choosing direction.
Disclaimer
This indicator and write-up are for education only, not financial advice. Trading involves risk; results vary by market, venue, and settings. Test first, act at defined levels, and manage risk. No guarantees or warranties are provided.
Core idea
This tool blends two trend MAs, a rolling Fibonacci grid, and pivot sweep tags so you can do three things quickly:
Trend → MA1 vs MA2 stack and slope
Location → Fib touch/bounce/reject rules
Triggers → sweep → reclaim or trend pullback → continuation
Use the MAs for bias, the Fib levels for where price should react, and the sweeps to spot traps and entries after liquidity grabs.
What you’ll see
MA 1 (default 21, purple) and MA 2 (default 50, gray)
Fib lines from the highest/lowest of your lookback: 0.236 (light blue), 0.382 (green), 0.5 (white), 0.618 (orange), 0.786 (red)
Sweep markers: triangle above = high sweep; triangle below = low sweep
Background: soft green when MA1 > MA2, soft red when MA1 < MA2
Read it fast → Trend (background + MA stack)? Which Fib are we near? Any sweep and reclaim?
How the Fib levels work (and what to do at each)
0.236 → shallow pullback in a strong trend
→ Expect quick bounce continuation.
→ If price closes through 0.236 and stalls, momentum may be cooling; look to 0.382.
0.382 → standard trend pullback
→ In a bullish trend, tests here often bounce and continue.
→ Entry idea: touch/bounce at 0.382 with MA1 above MA2 and rising, then a higher-low and push back above 0.382 → enter.
0.5 → midline / fair value
→ Often the “decision” level.
→ Clean continuation if 0.5 holds; deeper rotation if we accept below (for longs).
0.618 (“golden”) → deep pullback / last line for trend
→ Best risk-defined continuation entries come from rejects/reclaims here.
→ For longs: wick below 0.618, then reclaim 0.618 → long with stop under the sweep low.
0.786 → exhaustive pullback / trap zone
→ If trend is truly alive, 0.786 rejects and snaps back.
→ If we accept beyond 0.786 (closes), expect a full range rotation or trend change.
Touch/bounce rule of thumb
You want to see price interact: touch → reject (wick) → reclaim the level.
A close back above the Fib after a downside probe (or below after an upside probe) is a stronger confirmation than intrabar wicks.
What the MAs do (and how to use them)
MA1 (fast) vs MA2 (slow) define bias and momentum.
MA1 above MA2 and both rising (↗) → bullish regime.
MA1 below MA2 and both falling (↘) → bearish regime.
Flat / crossing often → balance; lean on sweeps and the deeper Fibs (0.5/0.618/0.786).
Interaction with Fibs
Highest quality: Fib level + MA confluence (e.g., 0.382 near MA1).
When MA1 = dynamic trigger: reclaim MA1 at a Fib → continuation signal.
When MA2 = last defense: lose MA2 at 0.5/0.618 → expect deeper rotation.
Sweep logic (why it matters and how to execute)
High sweep = current bar’s high takes out the recent high then fails → liquidity grab above.
Low sweep = current bar’s low takes the recent low then fails → liquidity grab below.
Execution idea
Longs: low sweep into 0.5/0.618/0.786, then reclaim the Fib and, ideally, MA1 → enter; stop under sweep low.
Shorts: high sweep into 0.5/0.382/0.236, then reclaim below the Fib and MA1 → enter; stop above sweep high.
Repaint note
If you enable Lag-Confirmed Pivot Mode, sweep labels are stricter and may “finalize” later (can appear as repaint).
For signals/alerts, prefer non-repaint mode; for review/training, lag-confirmed is fine.
How to trade it (simple playbook)
Direction filter (use MAs first)
Bullish bias → MA1 > MA2 and not flat → look for longs at 0.236/0.382/0.5.
Bearish bias → MA1 < MA2 → look for shorts at 0.236/0.382/0.5 from above.
Entries (two clean templates)
Trend pullback → continuation
→ In bull regime: price pulls to 0.382 or 0.5, shows rejection wick, then reclaims level and MA1 → enter long.
→ In bear regime: mirror with short from above.
Sweep → reclaim
→ Downside sweep through 0.618/0.786, then close back above the Fib and through MA1 → enter long.
→ Upside sweep through 0.382/0.236, then close back below and under MA1 → enter short.
Risk & targets
Stops → beyond the sweep extreme or below/above the reclaimed Fib (structure-based).
Targets → next Fib ladder (e.g., long from 0.5 → target 0.382 → 0.236), or obvious POC/HVNs if you use Volume Profile.
Settings that matter (and how to tune)
MA Types/Lengths
EMA (default fast) = responsive trend read.
SMA/HMA = smoother backbone.
21/50 is a solid default; swing traders can run 34/89.
Fib Lookback
Shorter lookback = tighter range, more sensitive levels;
Longer = broader swing map, fewer interactions but stronger signals.
Sweeps
Sweep Detection Range controls how “recent” the pivot must be (default 10).
Lag-Confirmed mode reduces false sweeps but can finalize later.
Starter presets
Intraday (15m–1H) → MA1 21 EMA, MA2 50 SMA, Fib lookback 100–150, Sweeps 10
Swing (4H) → MA1 34 EMA, MA2 89 SMA, Fib lookback 150–250, Sweeps 10–14
Pattern cheat sheet
0.382 kiss & go (trend day) → quick tag and bounce in bull regime → continuation.
0.5 decision → hold = trend resumes; failure = rotate to 0.618.
0.618 sweep + reclaim → high-quality continuation with tight risk.
0.786 trap → deep flush then snapback; if acceptance persists, expect full rotation.
MA pinch → break → MA1 and MA2 compress, then price breaks and holds a Fib → expansion leg.
Best combos (kept simple)
Volume Profile v3.2 [JopAlgo] → use VAH/VAL/POC/LVNs as concrete targets; look for Fib + VP confluence.
Anchored VWAP [JopAlgo] → reclaims/rejections at anchored lines with Fib reaction and MA agreement improve timing.
Common mistakes this helps you avoid
Buying into 0.618/0.786 without a reclaim (catching falling knives).
Fading a 0.236 pullback when MAs are strongly ↗ (fighting trend).
Taking sweeps without a reclaim/confirmation.
Ignoring the MA stack when choosing direction.
Disclaimer
This indicator and write-up are for education only, not financial advice. Trading involves risk; results vary by market, venue, and settings. Test first, act at defined levels, and manage risk. No guarantees or warranties are provided.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.