Indicator

Indicator

Gann Fan v15 [Phases + Signals]Gann Fan v15 is a strategy inspired by the classic Gann Fan and Gann Angles methodology attributed to W.D. Gann. Gann’s original approach studied the relationship between price, time, geometry, and market angles to identify trend strength, diagonal support and resistance, and potential changes in market behavior.
Credit:
The base concept of the fan angles comes from the Gann Fan / Gann Angles method attributed to W.D. Gann. This script does not claim to reproduce Gann’s original work exactly. It is an independent strategy built around that historical concept, with additional logic for phase detection, signal confirmation, visual analysis, and risk management.
What makes this strategy different:
This script is not only a traditional Gann Fan drawing tool. A classic Gann Fan usually plots diagonal angle levels from a selected high or low. This strategy adds a complete decision framework on top of the Gann Fan concept.
The main differences are:
1. Automatic pivot detection
The script automatically detects recent pivot highs and pivot lows instead of requiring the user to manually anchor the fan.
2. ATR-normalized angle calculation
Instead of using only fixed visual chart angles, the script calculates movement angles using ATR normalization. This helps adapt the angle reading to the volatility of the current symbol.
3. Market phase classification
The script classifies the market into four phases based on the calculated angle:
ACCUM: weak angle or low momentum.
MODER: moderate directional movement.
EXPAN: stronger directional expansion.
ACCEL: extreme acceleration.
4. Visual phase background
The chart background changes according to the detected phase and direction. This helps the user quickly identify whether the market is in accumulation, moderate movement, expansion, or acceleration.
5. LONG and SHORT signal logic
The strategy generates LONG and SHORT signals using Gann-inspired angle behavior, swing direction, EMA confirmation, and candle confirmation depending on the selected entry mode.
6. Multiple entry modes
The user can choose between three signal modes:
Strict, Medium, and Easy.
Each mode changes how much confirmation is required before a signal appears.
7. Built-in risk management
The strategy includes configurable Stop Loss, Take Profit, optional Trailing Stop, and visual TP/SL guide lines.
8. Dashboard
A table shows the current swing direction, live angle, current phase, bullish fan angle, bearish fan angle, active mode, and phase thresholds.
How the strategy enters LONG:
A LONG signal appears when the market structure is bullish and the selected entry mode confirms that the bullish movement has enough strength.
Mode 1 - Strict:
A LONG entry requires the market phase to transition from ACCUM or MODER into EXPAN or ACCEL. The swing must be bullish, EMA 8 must be above EMA 21, and the candle must close bullish.
Mode 2 - Medium:
A LONG entry can appear when the current phase is MODER, EXPAN, or ACCEL. The swing must be bullish, EMA 8 must be above EMA 21, and the candle must close bullish.
Mode 3 - Easy:
A LONG entry can appear when the current angle is above the weak angle threshold, the swing is bullish, price closes above EMA 8, and the candle is bullish.
How the strategy enters SHORT:
A SHORT signal appears when the market structure is bearish and the selected entry mode confirms that the bearish movement has enough strength.
Mode 1 - Strict:
A SHORT entry requires the market phase to transition from ACCUM or MODER into EXPAN or ACCEL. The swing must be bearish, EMA 8 must be below EMA 21, and the candle must close bearish.
Mode 2 - Medium:
A SHORT entry can appear when the current phase is MODER, EXPAN, or ACCEL. The swing must be bearish, EMA 8 must be below EMA 21, and the candle must close bearish.
Mode 3 - Easy:
A SHORT entry can appear when the current angle is above the weak angle threshold, the swing is bearish, price closes below EMA 8, and the candle is bearish.
Risk management:
The strategy includes a configurable Stop Loss percentage and Take Profit percentage.
When Trailing Stop is enabled, the Take Profit level is used as the trail activation price.
The strategy also includes an optional open-profit protection feature that can close the position after a minimum open profit condition is reached.
TP and SL levels are displayed on the chart while a position is active.
Visual elements:
Dynamic bullish and bearish Gann Fan levels.
Phase-colored background.
EMA 8 and EMA 21.
LONG and SHORT labels.
Live angle label.
Dashboard with current market state.
TP and SL lines.
Important usage notes:
Gann Fan and angle-based analysis can be sensitive to chart scaling, timeframe, volatility, and market conditions.
This strategy should be tested on each symbol and timeframe before use.
The default parameters are only a starting point.
Users should adjust the angle thresholds, pivot periods, Stop Loss, Take Profit, and Trailing Stop according to their own testing.
Disclaimer:
This script is for educational and analytical purposes only.
It does not provide financial advice.
It does not guarantee profits.
Past performance does not guarantee future results.
Always use proper risk management. Strategy

Fibonacci Structure Engine [WillyAlgoTrader]📐 Fibonacci Structure Engine is an overlay indicator that combines automatic Fibonacci retracement from live market structure with Smart Money Concepts (BOS/CHoCH detection), weighted confluence scoring, premium/discount zone classification, and context-filtered engulfing pattern entries — creating a complete structure-to-Fibonacci-to-entry workflow where every component feeds into the next.
The core idea: Fibonacci levels are only meaningful when drawn from the correct swing points. This indicator automates the entire process: it detects swing highs/lows with ATR-filtered pivot detection, identifies structure breaks (BOS) and trend reversals (CHoCH), anchors Fibonacci retracement levels from the structure-defined swing, trails the live edge as price extends, locks it when a confirmed pivot arrives, scores the confluence between current price and Fibonacci levels, and generates entry signals when engulfing patterns occur at high-confluence zones in the correct structural context.
Most Fibonacci tools on PulseWire require manual drawing — you select the swing high and low, and the levels appear. The problem: selecting the wrong swing, forgetting to update after a new structure break, or drawing from a minor swing that doesn't reflect the current trend leg. This indicator solves all three: the Fibonacci anchors update automatically on every structure break, trail the live edge as price extends, and lock when a confirmed pivot arrives — always reflecting the most relevant swing for the current market structure.
🧩 WHY THESE COMPONENTS WORK TOGETHER
Fibonacci retracement levels alone are static S/R lines. Structure detection alone tells you trend direction. Engulfing patterns alone fire everywhere. Confluence scoring alone has nothing to score against.
This indicator chains them into a dependency pipeline:
ATR-filtered swing detection → HH/HL/LH/LL classification → BOS/CHoCH structure breaks → Fibonacci anchor from structure swing → Live edge trailing + pivot locking → Fib level calculation → Confluence scoring (price vs Fib levels) → Premium/Discount zone classification → Engulfing pattern detection in structural context → Entry signal with cooldown
The swing detection feeds the structure engine — without confirmed pivots, no BOS/CHoCH can fire. The structure breaks anchor the Fibonacci levels — without a break, there's no swing to draw from. The Fibonacci levels feed the confluence scorer — without levels, there's nothing to score proximity against. The confluence score plus the premium/discount zone filter the engulfing patterns — without context, engulfing patterns produce too many false entries. And the signal cooldown prevents clustering from this entire chain.
Removing the structure detection breaks the Fibonacci anchoring. Removing the ATR filter floods the structure with noise swings. Removing the confluence scoring allows entries at non-Fibonacci prices. Removing the premium/discount filter allows bullish entries in premium (where sells should occur). Each component eliminates a specific failure mode.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ Structure-anchored Fibonacci with live edge trailing.
The Fibonacci engine uses a 4-phase lifecycle:
Phase 1 — Anchor on structure break: When a BOS or CHoCH is detected:
— Bullish break: top = current high (live, will trail), bottom = most recent swing low (locked)
— Bearish break: bottom = current low (live, will trail), top = most recent swing high (locked)
This instantly draws Fibonacci levels from the break point.
Phase 2 — Trail live edge: As price extends beyond the initial break, the live edge (top for bull, bottom for bear) updates to the new extreme. Fibonacci levels recalculate continuously to reflect the current move. This captures the full extent of the breakout without waiting for a pivot confirmation.
Phase 3 — Lock on pivot: When a confirmed swing high (for bullish trailing) or swing low (for bearish trailing) is detected by the pivot engine, the live edge locks to that confirmed pivot. The Fibonacci levels stop updating and represent the confirmed swing range.
Phase 4 — Update on new swings: When a new confirmed swing arrives that differs from the current locked anchor, the Fibonacci levels update to the new structure — always reflecting the most recent confirmed swing.
This lifecycle means the Fibonacci levels are always relevant: immediately reactive after a break (phases 1–2), then structurally confirmed once a pivot is detected (phases 3–4).
2️⃣ ATR-filtered pivot detection with noise suppression.
Standard ta.pivothigh/ta.pivotlow detects every local extreme, including minor fluctuations that don't represent real swing points. The ATR filter requires:
— For a swing high: the distance from the pivot high to the most recent swing low ≥ ATR × multiplier (default 0.5)
— For a swing low: the distance from the most recent swing high to the pivot low ≥ ATR × multiplier
This ensures only swings of meaningful size (relative to current volatility) are used for structure detection and Fibonacci anchoring. The multiplier is configurable: lower (0.2–0.3) for more granular structure, higher (0.8–1.0) for only major swings.
3️⃣ BOS / CHoCH structure detection with bias tracking.
The indicator tracks a persistent structureBias variable (+1 bullish, −1 bearish, 0 neutral):
— BOS (Break of Structure) : close breaks above the most recent swing high while bias is already bullish (or below swing low while already bearish) — trend continuation
— CHoCH (Change of Character) : close breaks above swing high while bias was bearish, or below swing low while bias was bullish — trend reversal
Each break requires: barstate.isconfirmed + the swing level hasn't been broken before (tracked via lastBrokenHigh/lastBrokenLow). Structure lines are drawn from the swing point to the break bar with configurable style (solid/dashed/dotted) and width.
4️⃣ Weighted confluence scoring (0–100).
The indicator measures how close the current price is to each Fibonacci level (within ATR × tolerance) and assigns weights by Fib importance:
— 0.236 → weight 1.0 (minor level)
— 0.382 → weight 1.5 (shallow retracement)
— 0.500 → weight 2.0 (equilibrium)
— 0.618 → weight 2.5 (golden ratio — highest weight)
— 0.786 → weight 1.5 (deep retracement)
Swing highs/lows within tolerance add +1.0 each. Total weight × 10 = confluence score (capped at 100). Classification: Strong (≥ 60), Moderate (≥ 30), Weak (> 0), None (0).
The tolerance is ATR-based (default 0.3× ATR) — on a volatile instrument, the "near" zone expands proportionally. On a quiet instrument, it tightens. This prevents false confluence readings from both too-tight and too-loose proximity checks.
5️⃣ Premium / Discount zone classification.
Using the 0.500 Fibonacci level as the equilibrium:
— Premium : close > Fib 0.500 — price is above equilibrium (expensive relative to the swing)
— Discount : close ≤ Fib 0.500 — price is below equilibrium (cheap relative to the swing)
This classification is used as a context filter for engulfing patterns: bullish engulfing patterns are only marked when price is in discount or at a confluence zone. Bearish engulfing patterns are only marked in premium or at a confluence zone. This prevents the most common engulfing failure mode: bullish patterns at the top of a range and bearish patterns at the bottom.
6️⃣ Context-filtered engulfing pattern detection.
The engulfing pattern detection requires:
— Current candle body > EMA(body, 14) — above-average body size (not a doji)
— Previous candle body < EMA(body, 14) — smaller previous candle (setup for engulf)
— Current candle fully engulfs previous candle's body
— Context filter: in premium/discount zone OR confluence weight ≥ 1.5
Bearish engulfing (▼): marked when price is in premium or near a Fib level — a reversal pattern at resistance. Bullish engulfing (▲): marked when price is in discount or near a Fib level — a reversal pattern at support.
7️⃣ Dual-path entry signals with cooldown.
Two entry paths:
— Engulfing + Structure + Confluence : engulfing pattern in context + structure bias aligned + confluence weight ≥ 1.5
— CHoCH (trend reversal) : any confirmed CHoCH — strong reversal signal, no additional confluence required
Both paths subject to signal cooldown (default 5 bars) to prevent clustering. Buy/Sell signals are displayed as labels (off by default — enable in Visual Settings).
8️⃣ Golden Zone + Target Zone visualization.
Two highlighted zones drawn as semi-transparent boxes:
— Golden Zone (0.500 – 0.786): the highest-probability retracement area. Where most retests find support/resistance.
— Target Zone (−0.500 – −0.618): the Fibonacci extension target for the next leg. Where price typically reaches after a confirmed retracement entry.
Both zones extend rightward by the configurable extension (default 20 bars) and update with Fibonacci level changes.
9️⃣ Seven configurable Fibonacci levels.
Individually toggleable: 0.236, 0.382, 0.500, 0.618, 0.786, −0.500, and Target (−0.618). Each drawn with distinct line styles — 0.618 is the thickest and most opaque (golden ratio emphasis), 0.236 is the thinnest (minor level). A dotted reference line connects the swing low to swing high showing the measured move.
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — Pivot detection: ta.pivothigh/ta.pivotlow with configurable lookback. ATR filter removes minor swings (swing size must exceed ATR × multiplier).
Step 2 — Swing tracking: Most recent two swing highs and two swing lows stored with bar indices. Each new swing is compared to previous → HH/HL/LH/LL classification.
Step 3 — Structure detection: Close breaks above swing high → BOS (if bias already bullish) or CHoCH (if bias was bearish). Same logic inverted for bearish breaks. Structure bias updated.
Step 4 — Fibonacci anchoring: On break → live edge set at current extreme, locked edge at swing. Live edge trails with price. Locks when confirmed pivot arrives. Updates on new swings.
Step 5 — Level calculation: fibLevel = swingHigh − (swingHigh − swingLow) × ratio for each ratio. Extension targets use negative ratios.
Step 6 — Confluence scoring: For each Fib level, check if |close − level| ≤ ATR × tolerance. Add weighted score. Include swing level proximity. Cap at 100.
Step 7 — Entry logic: Path A: engulfing in context + bias + confluence ≥ 1.5. Path B: CHoCH. Both respect cooldown.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator — Fibonacci levels and structure labels appear automatically
2. HH/HL/LH/LL labels show market structure
3. BOS/CHoCH labels show structure breaks and reversals
4. Yellow-shaded Golden Zone (0.500–0.786) = highest-probability retracement area
5. ▲/▼ arrows = engulfing patterns in structural context
6. Enable Buy/Sell Signals in Visual Settings for entry labels
👁️ Reading the chart:
— 🟢 HH / HL labels = bullish structure (higher highs, higher lows)
— 🔴 LH / LL labels = bearish structure (lower highs, lower lows)
— 🟢 "BOS" line + label = bullish break of structure (continuation)
— 🔴 "BOS" line + label = bearish break of structure
— 🟢🔴 "CHoCH" = Change of Character (trend reversal)
— 🔵 Horizontal lines = Fibonacci levels (0.236–0.786)
— 🟡 Shaded box (upper) = Golden Zone (0.500–0.786)
— 🟡 Shaded box (lower) = Target Zone (−0.500 to −0.618)
— 🟢 ▲ = bullish engulfing in discount / Fib zone
— 🔴 ▼ = bearish engulfing in premium / Fib zone
— 🟢 "BUY" / 🔴 "SELL" = confirmed entry signals (when enabled)
🔧 Tuning guide:
— Too many structure labels: increase Swing Length (12–20) or increase ATR Multiplier (0.7–1.0)
— Missing swings: decrease Swing Length (5–8) or decrease ATR Multiplier (0.2–0.3)
— Confluence too strict: increase Confluence ATR Tolerance (0.4–0.5)
— Too many engulfing signals: they self-filter by premium/discount — increase ATR Filter to reduce swing count
— Signal clustering: increase Signal Cooldown (8–15 bars)
⚙️ KEY SETTINGS REFERENCE
⚙️ Main:
— Swing Detection Length (default 10): pivot lookback — higher = larger swings
— ATR Swing Filter (default On): minimum swing size as ATR multiple
— ATR Filter Multiplier (default 0.5): how large swings must be
— Signal Cooldown (default 5): bars between consecutive signals
📐 Fibonacci:
— Show Fibonacci Levels (default On)
— Fib Extension Bars (default 20): rightward line extension
— Individual level toggles : 0.236 (off), 0.382, 0.500, 0.618, 0.786, −0.5, Target −0.618
— Confluence ATR Tolerance (default 0.3): proximity threshold
🏗️ Structure:
— BOS / CHoCH (default On): show structure break lines and labels
— Swing Labels (default On): HH/HL/LH/LL on pivots
— Engulfing Signals (default On): context-filtered patterns
🎨 Visual:
— Buy/Sell Signals (default Off): enable for entry labels
— Structure line style (Solid/Dashed/Dotted) and width (1–4)
— Auto / Dark / Light theme
🔔 Alerts
— 🟢 BUY / 🔴 SELL — ticker, price, TF, confluence score, SL, TP
— 🔵 BOS — structure break with direction
— 🟡 CHoCH — trend reversal with direction
All support plain text and JSON webhook format. Bar-close confirmed.
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All structure breaks and signals require barstate.isconfirmed. Pivot detection uses equal left/right lookback (swingLen/swingLen) — pivots are confirmed swingLen bars after the actual high/low. Fibonacci levels update on confirmed pivots and structure breaks only.
— 📐 The Fibonacci anchor system has two states per edge: live and locked . A live edge trails with price (capturing the full move after a break). A locked edge is confirmed by a pivot. You'll see the Fibonacci levels shift on bar close as the live edge updates — this is by design, not repainting. Once the pivot locks, levels stabilize.
— ⚖️ The 0.618 level carries the highest confluence weight (2.5) because it is the golden ratio — the most statistically significant Fibonacci retracement level. The 0.500 carries weight 2.0, while the extreme levels (0.236, 0.786) carry 1.0–1.5.
— 📊 Buy/Sell signals are off by default . The indicator is designed primarily as a structure + Fibonacci analysis tool. Enable signals in Visual Settings when you want automated entry detection.
— 🔄 CHoCH signals do not require confluence — they represent a structural trend reversal, which is inherently a high-conviction event. Engulfing-based entries require confluence weight ≥ 1.5 + correct structural bias.
— 📏 The Golden Zone (0.500–0.786) is the area where most successful retests occur . The Target Zone (−0.500 to −0.618) is the area where the next impulse leg typically reaches. Both are highlighted with semi-transparent boxes.
— 🛠️ This is a structure analysis and Fibonacci visualization tool , not an automated trading bot. It maps market structure, draws Fibonacci levels, scores confluence, and identifies high-probability entry zones — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. Indicator

Gann Fan [UAlgo]Gann Fan is a structure driven Gann angle overlay that automatically builds a multi line fan from the most relevant recent swing anchor on the chart. Instead of requiring manual drawing, the script detects pivot highs and pivot lows, selects an active anchor based on the latest structure, and projects a full set of classic Gann style ratios from that anchor point.
The indicator runs directly on price and is designed to provide a clean visual map of potential dynamic support, resistance, and trend geometry. Once an anchor is chosen, the script draws a nine line fan that includes the key 1x1 line along with slower and faster angle ratios such as 1x8, 1x4, 1x3, 1x2, 2x1, 3x1, 4x1, and 8x1. These lines extend forward in time, creating a structured framework that traders can use for directional bias, reaction zones, and acceleration or deceleration analysis.
A major strength of this implementation is that it is not just a static angle pack. The script first builds an alternating pivot structure, filters same side pivots so only the more extreme one is retained, then automatically determines whether the active fan should be bullish or bearish when Auto mode is enabled. It also adds optional visual enhancements such as glow effects, filled fan zones between adjacent angles, angle labels, and an anchor label.
The result is a polished automatic Gann Fan tool focused on:
Recent swing structure
Auto or forced bullish / bearish direction
Multi angle projection
Visual zone segmentation
Clean right side angle labeling
🔹 Features
🔸 1) Automatic Gann Fan Projection
The script automatically draws a full Gann fan without requiring manual anchor placement. It detects recent pivots, determines the most relevant active anchor, and projects all fan angles from that point.
This makes it useful for traders who want a repeatable, rules based Gann framework rather than hand drawn discretionary lines.
🔸 2) Pivot Based Structural Anchoring
The fan is built from confirmed pivot highs and pivot lows using a configurable pivot strength setting. These pivots form the structural basis for the fan, so the projection adapts to actual swing development instead of arbitrary recent highs and lows.
🔸 3) Alternating Swing Logic for Cleaner Structure
The script does not blindly store every pivot. It enforces an alternating sequence of highs and lows:
If a new pivot is the same type as the most recent stored one, only the more extreme pivot is kept
If it is the opposite type, it is appended normally
This produces a cleaner swing map and avoids clutter from redundant same side pivots.
🔸 4) Auto, Bullish, or Bearish Fan Direction
Users can choose:
Auto mode
Forced Bullish
Forced Bearish
In Auto mode, the script decides direction based on which pivot type occurred most recently. This makes the fan respond naturally to the latest structural context.
🔸 5) Full Nine Angle Set
The indicator plots a broad set of classic Gann style ratios:
1x8
1x4
1x3
1x2
1x1
2x1
3x1
4x1
8x1
This creates a layered angle framework ranging from shallow to steep, with the 1x1 line visually emphasized as the main reference line.
🔸 6) Highlighted 1x1 Line
The 1x1 line receives its own dedicated width and stands out from the rest of the fan. This makes it easier to focus on the central balance angle that many traders treat as the most important Gann reference.
🔸 7) Optional Glow Effect
The script can render a wider translucent glow line beneath each fan line. This improves visibility, gives the fan a premium visual style, and helps the angle set stand out on busy charts.
🔸 8) Optional Fan Zones Between Angles
When enabled, the script fills the space between adjacent fan lines to create alternating fan zones. These colored bands make it easier to visually read the space between angles as active directional sectors.
This is especially useful when treating the fan as a dynamic channel structure rather than only a set of lines.
🔸 9) Right Side Angle Labels
Each fan angle can be labeled on the right side using the actual ratio name, such as 1x1 or 4x1 . The label position is user adjustable through the label shift setting.
This makes the fan immediately readable without needing to memorize line order.
🔸 10) Anchor Label Support
The script can place an anchor label at the origin point of the active fan, showing whether the current projection is bullish or bearish. This helps confirm which structural direction is currently active.
🔸 11) Customizable Line and Label Styling
Users can control:
Base line width
1x1 line width
Glow width
Label size
Label shift
Zone visibility
Glow visibility
Anchor label visibility
This makes the tool flexible for both minimalist and presentation focused layouts.
🔸 12) Structure Memory Control
The Max Stored Pivots setting controls how many swing points remain in memory. This helps the script stay efficient while still maintaining enough structural context for reliable anchor selection.
🔹 Calculations
1) Pivot Detection
The script identifies structural swing highs and lows using:
float ph = ta.pivothigh(high, pivotLen, pivotLen)
float pl = ta.pivotlow(low, pivotLen, pivotLen)
A pivot is only confirmed after pivotLen bars on both sides, so the stored pivot index is aligned to the actual pivot bar:
SwingPoint.new(bar_index - pivotLen, ph, true)
SwingPoint.new(bar_index - pivotLen, pl, false)
This ensures the fan anchor uses the true swing location, not the later confirmation bar.
2) Alternating Swing Storage
The script maintains a swing array that enforces alternating highs and lows:
if last.isHigh == candidate.isHigh
bool moreExtreme = (candidate.isHigh and candidate.price >= last.price) or (not candidate.isHigh and candidate.price <= last.price)
if moreExtreme
points.set(n - 1, candidate)
else
points.push(candidate)
Interpretation:
If two consecutive pivots are both highs, only the higher high is kept.
If two consecutive pivots are both lows, only the lower low is kept.
This keeps the swing structure cleaner and more meaningful.
3) Auto Direction Logic
In Auto mode, the script chooses bullish or bearish orientation based on which pivot type is most recent:
bool autoBull = not lastLow.isNa() and (lastHigh.isNa() or lastLow.idx > lastHigh.idx)
Interpretation:
If the latest valid pivot is a low, the script favors a bullish fan.
If the latest valid pivot is a high, the script favors a bearish fan.
The final direction can still be overridden by the Fan Direction input.
4) Bullish Anchor Construction
For a bullish fan, the script starts from the most recent low pivot:
SwingPoint lastLow = swings.lastPivot(false)
Then it looks for the most recent high pivot that occurred after that low:
SwingPoint ctrlHigh = swings.lastPivotAfter(true, lastLow.idx)
If such a high exists, it becomes the control point.
If not, the script uses the current bar and current high:
int x2 = ctrlHigh.isNa() ? bar_index : ctrlHigh.idx
float y2 = ctrlHigh.isNa() ? high : ctrlHigh.price
So the bullish fan is anchored from the latest significant low toward the next available structural high, or toward the live chart if that swing is still developing.
5) Bearish Anchor Construction
For a bearish fan, the script starts from the most recent high pivot:
SwingPoint lastHigh = swings.lastPivot(true)
Then it looks for the most recent low pivot that occurred after that high:
SwingPoint ctrlLow = swings.lastPivotAfter(false, lastHigh.idx)
If none is found yet, the script falls back to the current bar and current low:
int x2 = ctrlLow.isNa() ? bar_index : ctrlLow.idx
float y2 = ctrlLow.isNa() ? low : ctrlLow.price
So the bearish fan projects from the latest significant high toward the next structural low, or toward the live chart while the move is still unfolding.
6) Base Slope Calculation
Once the anchor is defined, the script computes the base slope between anchor point 1 and point 2:
(anchor.p2 - anchor.p1) / (anchor.idx2 - anchor.idx1)
This base slope is the reference slope used for the 1x1 line before applying the fan ratios.
7) Gann Ratio Projection
The script stores these ratios:
array.from(0.125, 0.25, 0.333333, 0.5, 1.0, 2.0, 3.0, 4.0, 8.0)
These correspond to:
1x8
1x4
1x3
1x2
1x1
2x1
3x1
4x1
8x1
For each ratio, the projected line value at any bar x is:
anchor.p1 + m * ratio * (x - anchor.idx1)
Where m is the base anchor slope.
This means:
Ratios below 1 create flatter angles than the base line
Ratio 1 creates the 1x1 line
Ratios above 1 create steeper angles than the base line
8) 1x1 Emphasis
The script gives the 1x1 line special treatment:
It uses mainLineWidth instead of baseLineWidth
Its glow can also be slightly wider than the other lines
This makes the central balance angle the visually dominant line in the fan.
9) Line Drawing and Extension
Each fan line is drawn from the anchor origin to the control index, then extended to the right:
line.new(
active.idx1, active.p1,
active.idx2, y2,
xloc = xloc.bar_index,
extend = extend.right,
...
)
This means the visible geometry is anchored in actual structure, but the line continues into the future as a projected guide.
10) Glow Layer Logic
If glow is enabled, the script first draws a wider translucent line underneath the main line:
line.new(... color = glowColor, width = gWidth)
Then it draws the normal fan line on top. This creates a soft highlight effect without changing the underlying geometry.
11) Angle Label Placement
If labels are enabled, the script places each label at a future bar location:
int xLabel = math.min(bar_index + labelShiftBars, bar_index + 500)
float yLabel = active.priceAt(ratio, xLabel)
This means the label stays attached to the correct projected fan angle while remaining offset from the live candles for readability.
12) Fan Zone Fill Logic
When zone fill is enabled, the script creates a fill between each adjacent pair of fan lines:
linefill.new(l1, l2, zoneColor)
The fill transparency alternates slightly from one band to the next:
int zoneAlpha = i % 2 == 0 ? 91 : 95
This creates subtle separation between fan sectors and improves visual depth.
13) Anchor Label Logic
If enabled, the script prints a label at the anchor origin:
string dirText = active.bullish ? "Bullish Gann Fan" : "Bearish Gann Fan"
This provides immediate confirmation of which structural direction is currently driving the fan. Indicator

Automatic Fibonacci Levels [WillyAlgoTrader]Automatic Fibonacci Levels is an overlay indicator that detects the dominant swing high and swing low within the visible chart area, draws a full Fibonacci retracement and extension grid between them, highlights the Optimal Trade Entry (OTE) zone at 61.8%–78.6%, marks a target zone at the −50% to −61.8% extension, and labels four take-profit levels — all updating automatically as you scroll or zoom the chart.
Most Fibonacci tools on PulseWire are either manual (you draw them yourself and they become stale as price evolves) or pivot-based (anchored to a fixed lookback period that may not match the swing you're actually looking at). This indicator takes a different approach: it uses the visible chart range as its context. It finds the highest high and lowest low within what you can currently see, determines trend direction based on which came first, and draws the full Fibonacci grid accordingly. When you scroll or zoom to a different area, the grid adapts — making it a dynamic analysis companion rather than a static drawing tool.
🔍 WHAT MAKES IT ORIGINAL
1. Visible-range swing detection. Instead of using a fixed pivot lookback or requiring manual anchor placement, the indicator scans the chart's visible window (chart.left_visible_bar_time to chart.right_visible_bar_time) to find the absolute high and low. This means the Fibonacci grid always reflects the swing structure you are currently analyzing. Zoom into a 50-bar range to see intraday retracements; zoom out to 500 bars to see the macro structure — the grid adjusts automatically. When the visible range changes (scroll or zoom), swing detection resets and recalculates.
2. Automatic trend direction from swing sequence. The indicator determines bullish or bearish bias by comparing when the swing low and swing high occurred. If the swing low formed first and the swing high formed later, the trend is classified as bullish (retracement levels are drawn down from the high, extensions project upward). If the swing high came first, the trend is bearish (retracement down from the low, extensions project downward). No manual input is needed — the grid orientation follows the price structure.
3. OTE Entry Zone + Target Zone as highlighted boxes. Two key zones are highlighted with semi-transparent boxes:
— Entry Zone (61.8%–78.6%) : the Optimal Trade Entry area from ICT/SMC methodology — the deep retracement zone where institutional re-entry is most likely
— Target Zone (−50% to −61.8%) : the extension zone where breakout moves frequently reach
Both zones have configurable colors and optional text labels ("ENTRY ZONE" / "TARGET ZONE") inside them. Zone-touch alerts fire when price enters either box for the first time.
4. Four labeled take-profit levels. TP labels are placed at key Fibonacci levels to provide a structured scale-out framework:
— TP1 at 38.2% (first retracement target — conservative exit)
— TP2 at 0% (full swing retest — swing high in uptrend, swing low in downtrend)
— TP3 at −27.2% (first Fibonacci extension)
— TP4 at −61.8% (deep extension — runner target)
Each TP level is only displayed if the corresponding Fibonacci line is enabled, keeping the chart clean.
5. 16 individually toggleable levels. The indicator supports a comprehensive set of levels: 0%, 23.6%, 38.2%, 50%, 61.8%, 70.6%, 78.6%, 100% (standard retracements), plus 18%, 150%, 200% (deep retracements), and −18%, −27.2%, −50%, −61.8%, −100% (extensions). Each level can be toggled on or off independently, so you can configure exactly the grid density you prefer — from a minimal 4-level setup to a full 16-level deep analysis.
⚙️ HOW IT WORKS
Swing detection:
On every bar, the script checks whether the current bar falls within the chart's visible time window (using chart.left_visible_bar_time and chart.right_visible_bar_time). Within this window, it tracks the highest high and lowest low, along with their bar indices. When the visible window changes (scroll/zoom), all swing data resets and recalculates from scratch. This ensures the grid always reflects your current view.
Trend direction:
If swingLowBarIdx < swingHighBarIdx (low came first), the trend is classified as bullish — Fibonacci levels count downward from the swing high (0% = high, 100% = low), and extensions project above the high. If the high came first, the trend is bearish — levels count upward from the swing low, extensions project below.
Level calculation:
Each Fibonacci level is calculated as: price = anchor ± (swingRange × ratio), where the anchor and direction depend on the trend bias. For a bullish trend: 0% = swingHigh, 61.8% = swingHigh − range × 0.618, −50% = swingHigh + range × 0.5. For bearish: mirrored.
Zone detection:
The Entry Zone (61.8%–78.6%) and Target Zone (−50% to −61.8%) are computed as price ranges. On each confirmed bar, the script checks if the close falls within either zone. A zone-touch alert fires on the first confirmed bar inside the zone (no repeated alerts while price stays in the zone). The inEntryZone / inTargetZone state resets when price leaves, allowing re-entry detection.
Drawing:
All visual elements (lines, labels, boxes) are drawn on barstate.islast and cleaned up on each redraw to prevent accumulation. Lines extend from 2 bars before the current bar to the label offset position. Zones use extend.right so they remain visible as new bars form.
📖 HOW TO USE
Reading the chart:
— Orange horizontal lines = Fibonacci levels (retracement + extensions)
— Optional % labels next to each line = level identification
— Gold semi-transparent box = Entry Zone (61.8%–78.6% OTE)
— Gold semi-transparent box with "TARGET ZONE" = extension target (−50% to −61.8%)
— TP1–TP4 labels = structured take-profit levels
— Optional diagonal line = swing connection (low-to-high or high-to-low)
Suggested workflow:
— Zoom to the swing you want to analyze — the grid adapts automatically
— In a bullish trend: look for buy entries when price retraces into the Entry Zone (61.8%–78.6%), with stop loss below 100% (swing low), targeting TP1 (38.2%) → TP2 (0% / swing high) → TP3 (−27.2%) → TP4 (−61.8%)
— In a bearish trend: look for sell entries when price retraces up into the Entry Zone, stop above swing high, targeting downward extensions
— Use the dashboard to confirm trend direction and monitor whether price is currently in the Entry or Target zone
— Set alerts for zone touches to get notified when price reaches OTE or target levels without watching the chart
Customization tips:
— For a clean chart: enable only 0%, 61.8%, 78.6%, 100%, −27.2%, −61.8% — this gives you the OTE boundaries, swing anchors, and two extension targets
— For deep analysis: enable all 16 levels to see the full Fibonacci structure
— Adjust Label Offset to move level labels further right if your chart is crowded
— Toggle Show Diagonal Swing Line to visually confirm which high/low pair is being used
⚙️ KEY SETTINGS REFERENCE
— Show All Elements (default On): master toggle for all Fibonacci visuals
— Line Width (default 1): thickness of Fibonacci lines (1 = subtle, 5 = bold)
— Line Style (default Dashed): solid, dashed, or dotted
— Label Offset (default 17 bars): how far right of the last bar to place labels
— Individual Levels : 16 toggleable levels from 200% to −100%
— Show Entry Zone (default On): highlight the 61.8%–78.6% OTE box
— Show Target Zone (default On): highlight the −50% to −61.8% extension box
— Show Text in Zones (default On): display "ENTRY ZONE" / "TARGET ZONE" labels
— Show TP Labels (default On): display TP1–TP4 at key levels
— Show Level % Labels (default Off): display percentage text next to each line
📊 Dashboard
The info panel displays:
— Trend direction (Bullish / Bearish) based on swing sequence
— Signal status (Entry Zone / Target Zone / —) when price enters a key zone
— Swing range in price units
— Current timeframe and indicator version
🔔 Alerts
Two alert conditions (each fires once per zone entry on bar close):
— Entry Zone touch : price closes inside the 61.8%–78.6% retracement zone
— Target Zone touch : price closes inside the −50% to −61.8% extension zone
Both support standard text and JSON webhook format.
⚠️ IMPORTANT NOTES
— This indicator anchors to the visible chart range — it recalculates when you scroll or zoom. This is a feature, not a bug: it lets you analyze any swing by simply framing it on your screen. However, it means the grid will change if you move the chart.
— Fibonacci levels are not predictive — they are reference points based on the measured swing range. Price may or may not react at any given level.
— The Entry Zone (61.8%–78.6%) is derived from the OTE concept used in ICT/SMC methodology. It represents a high-probability retracement area, but no retracement zone guarantees a reversal.
— Zone alerts require bar-close confirmation and fire once per entry — they do not repeat while price remains in the zone.
— Works across all asset classes and timeframes. No volume data required. Indicator

Fibo RSIThis is a customized Relative Strength Index (RSI) indicator designed to replicate PulseWire’s default RSI while adding additional reference levels for deeper market analysis.
🔹 Features:
RSI length set to 8 by default (user adjustable).
Calculates RSI using the standard ta.rsi() function.
Plots the RSI line in a clean, separate panel.
Adds 7 key levels for analysis: 0, 20, 30, 50, 70, 80, 100.
Levels are drawn as thin, solid straight lines for a cleaner look (instead of default dashed).
🔹 Use cases:
Identify momentum shifts with enhanced precision.
Use intermediate levels (20, 30, 50, 70, 80) as potential support/resistance zones.
Ideal for traders who want a Fibonacci-like structure in RSI analysis. Indicator

Script_Algo - Fibo Correction Strategy🔹 Core Concept
The strategy is built on combining Fibonacci retracement levels, candlestick pattern confirmation, and trend filtering for trade selection. It performs well on the 1-hour timeframe across many cryptocurrency pairs. Particularly on LINKUSDT over the past year and a half, despite the not very optimal 1:1 risk/reward ratio.
The logic is simple: after a strong impulse move, the price often retraces to key Fibonacci levels (specifically, the 61.8% level). If a confirming candlestick (pattern) appears at this moment, the strategy looks for an entry in the direction of the main trend.
🔹 Indicators Used in the Strategy
ATR (Average True Range) — Used to calculate the stop-loss and take-profit levels.
EMA (9 and 21) — Additional moving averages for assessing the direction of movement (not directly used in entry conditions, but the logic can be expanded to include them).
SMA (Trend Filter, 20 by default) — The trend direction filter. Trades are only opened in its direction.
Fibonacci Levels — The 61.8% retracement level is calculated based on the high and low of the previous candle.
🔹 Entry Conditions
🟢 Long (Buy):
Previous Candle:
Must be green (close higher than open).
Must have a body not smaller than a specified minimum.
The upper wick must not exceed 30% of the body size.
→ This filters out "weak" or "indecisive" candles.
Current Candle:
Price touches or breaches the Fibonacci 61.8% retracement level from the previous range.
Closes above this level.
Closes above the Trend Filter (SMA) line.
A position is opened only if there are no other open trades at the moment.
🔴 Short (Sell):
Previous Candle:
Must be red (close lower than open).
Must have a body not smaller than a specified minimum.
The lower wick must not exceed 30% of the body size.
Current Candle:
Price touches or breaches the Fibonacci 61.8% retracement level from the previous range.
Closes below this level.
Closes below the Trend Filter (SMA) line.
A trade is opened only if there are no other open positions.
🔹 Risk Management
Stop-Loss = ATR × multiplier (default is 5).
Take-Profit = ATR × the same multiplier.
Thus, the default risk/reward ratio is 1:1, but it can be easily adjusted by changing the coefficient. Although, strangely enough, this ratio has shown the best results on some assets on the 1-hour timeframe.
🔹 Chart Visualization
Fibonacci level for Long — Green line with circles.
Fibonacci level for Short — Red line with circles.
Trend Filter line (SMA) — Blue.
🔹 Strengths of the Strategy
✅ Utilizes a proven market pattern — retracement to the 61.8% level.
✅ Further filters entries using trend and candlestick patterns.
✅ Simple, transparent logic that is easy to expand (e.g., adding other Fib levels, an EMA filter, etc.).
🔹 Limitations
⚠️ Performs better in trending markets; can generate false signals during ranging (sideways) conditions.
⚠️ The fixed 1:1 risk/reward ratio is not always optimal and could be refined.
⚠️ Performance depends on the selected timeframe and ATR parameters.
📌 Summary:
The strategy seeks corrective entries in the direction of the trend, confirmed by candlestick patterns. It is versatile and can be applied to forex pairs, cryptocurrencies, and stocks.
⚠️ Not financial advice. Pay close attention to risk management to avoid blowing your account. The strategy is not repainting — I have personally verified it through real testing — but it may not necessarily replicate the same results in the future, as the market is constantly changing. Test it, profit, and good luck to everyone! Strategy

Indicator

Indicator

fibo_levelsLibrary "Fibo_levels"
Calculate Fibo levels from any 2 levels. Your need know only 2 price of 2 levels for calculate any level of Fibo: function 'fibo_lvl',
or calculate array of price Fibo levels : function 'fibo_lvls'
fibo_lvl(fibo_lvl1, price1, fibo_lvl2, price2, calc_level)
Parameters:
fibo_lvl1 : First of any level of fibo from 0 to 1 (example 0.236)
price1 : Price for 1th any level (example 2356.1)
fibo_lvl2 : Second of any level of fibo from 0 to 1 (example 0.382)
price2 : Price for 2th any level (example 2497.4)
calc_level : Price for level to calculate (example 0.5)
Returns: return price for calc_level fibo
fibo_lvls(bars, time1, time2, fibo_lvl1, price1, fibo_lvl2, price1)
Parameters:
fibo_lvl1 : First of any level of fibo from 0 to 1 (example 0.236)
price1 : Price for 1th any level (example 2356.1)
fibo_lvl2 : Second of any level of fibo from 0 to 1 (example 0.382)
price1 : Price for 2th any level (example 2497.4)
Returns: array of price for fibo levels : (0.0, 0.118, 0.236, 0.384, 0.5, 0.618, 0.786, 1.0, 1.27,-0.27,1.618,-0.618) Library

Library

Indicator

Indicator

Library

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator
