OPEN-SOURCE SCRIPT
Updated Precision Sniper [WillyAlgoTrader]

🎯 Precision Sniper is an overlay indicator that generates entry signals only when a 10-factor confluence scoring engine reaches a configurable threshold — combining EMA alignment, RSI momentum, MACD direction, VWAP position, volume confirmation, ADX trend strength, DI directional pressure, and higher-timeframe bias into a single composite score (0–10). Every signal comes with automatic TP/SL placement using either ATR-based or structure-based stops, plus a progressive trailing stop system that ratchets the stop to breakeven after TP1 and to TP1 level after TP2.
The core principle: instead of using a single crossover or oscillator reading to trigger a signal, this indicator requires multiple independent market dimensions to agree simultaneously. An EMA crossover alone can produce false signals in choppy markets. RSI confirmation alone can be early or late. Volume alone doesn't tell you direction. But when EMA alignment + RSI momentum + MACD direction + VWAP position + volume + ADX + DI + HTF trend all point the same way — and the composite score exceeds your threshold — the probability of a genuine directional move is significantly higher than any single factor alone.
🧩 WHY THESE COMPONENTS WORK TOGETHER
Each factor in the scoring engine measures a different market dimension:
— EMA Fast/Slow crossover → detects the momentum shift that initiates the signal (trigger)
— EMA Trend → confirms the macro direction (structural filter)
— RSI → confirms momentum is in the non-extreme zone (avoids overbought entries)
— MACD histogram + MACD vs signal → confirms momentum is accelerating, not decelerating (2 factors)
— VWAP position → confirms price is on the right side of institutional fair value
— Volume → confirms market participation (not a low-liquidity wick)
— ADX + DI → confirms the market is trending AND directional pressure aligns (not ranging)
— HTF EMA bias → confirms the higher-timeframe trend agrees with the entry direction
These factors are deliberately orthogonal: EMA alignment can occur without volume, MACD can be bullish without RSI confirming, price can be above VWAP while ADX shows no trend. The scoring engine counts how many factors agree — only when enough dimensions align does the signal pass.
The entry signal feeds into the risk management system: structure-based SL provides a structurally meaningful stop (recent swing low/high), the R:R-based TPs create consistent reward targets, and the progressive trailing stop automatically manages the trade after entry — ratcheting protection as each target is hit. Without the trailing system, a signal that hits TP1 can still reverse to SL for a full loss. With it, after TP1 the worst case is breakeven.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ 10-factor confluence scoring engine (0–10 scale).
Every bar, both a bullish and bearish score are computed from 10 independent factors:
Bullish score calculation:
— 📐 EMA Fast > EMA Slow → +1.0 (short-term momentum is upward)
— 📏 Close > EMA Trend → +1.0 (price is above macro trend)
— 📊 RSI > 50 AND RSI < 75 → +1.0 (momentum is bullish but not overbought)
— 📈 MACD Histogram > 0 → +1.0 (momentum is positive)
— 📈 MACD Line > Signal Line → +1.0 (MACD has bullish crossover)
— ⚖️ Close > VWAP → +1.0 (price above institutional fair value)
— 📊 Volume > SMA(20) × 1.2 → +1.0 (above-average participation)
— 💪 ADX > 20 AND +DI > −DI → +1.0 (trending market with bullish pressure)
— 🌐 HTF EMA Fast > HTF EMA Slow → +1.5 (higher timeframe confirms direction)
— ✅ Close > EMA Fast → +0.5 (price is above the fast MA — minor confirmation)
Maximum bullish score: 10.0. Bearish score uses symmetric conditions (< instead of >, −DI > +DI, etc.). The HTF factor carries 1.5× weight because higher-timeframe alignment is the single strongest predictor of signal quality. The close > EMA Fast factor carries 0.5× because it's partially redundant with the crossover — it adds a minor confirmation that price didn't just touch the crossover but is clearly above it.
A signal fires when: EMA crossover occurs + price is on the correct side of both EMAs + RSI is not extreme + composite score ≥ Min Confluence Score (default 5 out of 10).
2️⃣ Structure-based stop loss with ATR fallback.
When enabled (default on), the stop loss is placed at the most structurally meaningful level:
For long trades:
— structureStop = recent swing low (over configurable lookback, default 10 bars) − 0.2× ATR padding
— atrStop = entry − ATR × SL multiplier
— finalStop = max(structureStop, atrStop) — the HIGHER (tighter) of the two
This "pick the tighter stop" logic ensures the SL is always at a meaningful structural level but never further than the ATR-based maximum. A minimum distance of 0.5× ATR is enforced to prevent unrealistically tight stops when the swing low is very close to entry.
For short trades: symmetric logic with min() instead of max(), swing high + padding.
When structure SL is disabled, the stop uses pure ATR: SL = entry ± ATR × multiplier.
3️⃣ Progressive trailing stop system.
After entry, the stop ratchets progressively as targets are hit:
— Initial state: SL at structure/ATR level
— After TP1 hit: SL moves to entry price (breakeven) — worst case is now 0 loss
— After TP2 hit: SL moves to TP1 level — worst case is now TP1 profit locked
— After TP3 hit: SL moves to TP2 level — TP2 profit locked, runner continues
The trailing stop line updates dynamically on the chart (orange dotted line with label). The SL hit check uses the pre-update trail value to prevent same-bar conflicts: if TP1 and the trail are both touched on the same candle, the TP1 hit processes first, then the trail is checked against its PRE-move value.
This progressive system means that once a trade reaches TP1, it can only end in breakeven or profit — never a loss. After TP2, the minimum outcome is TP1 profit locked.
4️⃣ Four presets with parameter scaling.
Each preset adjusts two key parameters:
— Conservative: min score floor 7/10, SL floor 2.0× ATR — requires strong consensus, wider stop
— Default: uses your manual settings
— Aggressive: min score ceiling 3/10, manual SL — accepts lighter consensus
— Scalping: min score ceiling 4/10, SL ceiling 1.0× ATR — lower bar, tighter stop
The preset modifies the effective score threshold and SL multiplier — the underlying 10 factors don't change, only how many must agree and how wide the stop is.
5️⃣ Volatility regime detection.
The dashboard displays the current volatility regime: volRatio = ATR(14) / SMA(ATR, 42). High (ratio > 1.3) = volatility above average — consider wider stops. Low (ratio < 0.7) = volatility compressed — watch for breakout. Normal = standard conditions. This provides at-a-glance context for how the current environment affects your settings.
6️⃣ EMA ribbon with macro trend overlay.
Three EMAs create a visual trend system:
— EMA Fast (default 9) = short-term momentum direction
— EMA Slow (default 21) = medium-term trend
— EMA Trend (default 55) = macro trend filter (shown as dot-style line)
The fast/slow ribbon fills green when fast > slow (bullish momentum) and red when fast < slow. Signals only fire when the EMA crossover occurs AND price confirms by closing on the correct side of both EMAs.
7️⃣ RSI extreme avoidance.
The signal engine requires RSI to be in a non-extreme zone: bullish signals require RSI > 50 AND < 75 (not overbought). Bearish signals require RSI < 50 AND > 25 (not oversold). This prevents the most common failure mode of momentum-based entries: buying into an already overbought market or selling into an oversold bounce.
8️⃣ Direction lock — one signal per trend leg.
After a buy signal fires, the next signal can only be a sell (and vice versa). This prevents signal clustering during strong trends where the confluence score might cross the threshold multiple times. If both buy and sell trigger on the same bar (rare edge case), buy takes priority (mutual exclusion).
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — Core indicators: EMA Fast(9), EMA Slow(21), EMA Trend(55), RSI(13), MACD(12/26/9), VWAP(hlc3), Volume SMA(20), ADX/DI(14), HTF EMAs via request.security with [1] + lookahead_on.
Step 2 — Confluence scoring: 10 factors evaluated independently for both bullish and bearish directions. Each factor adds its weight (1.0, 1.5, or 0.5) to the composite score. Max score = 10.0 per direction.
Step 3 — Signal trigger: EMA crossover (fast crosses slow) + price above/below both EMAs + RSI not extreme + composite score ≥ threshold + direction lock → confirmed signal on barstate.isconfirmed.
Step 4 — SL calculation: Structure mode: recent swing low/high ± 0.2× ATR padding, then pick the tighter of structure vs ATR stop. Minimum distance enforced at 0.5× ATR. Risk = |entry − SL|.
Step 5 — TP placement: TP1 = entry ± risk × tp1RR, TP2 = entry ± risk × tp2RR, TP3 = entry ± risk × tp3RR.
Step 6 — Trade monitoring: Each bar: check TP1/TP2/TP3 hits → ratchet trailing stop. Check SL hit against pre-ratchet trail value. Update visual lines and labels.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator — the EMA ribbon appears showing current trend
2. Select a preset (Conservative for swing, Scalping for 1–5M)
3. Wait for a "Long" or "Short" label — check the dashboard for score
4. Entry, SL, TP1, TP2, TP3 lines appear automatically
5. After TP1 → orange trailing stop line moves to breakeven
6. After TP2 → trail moves to TP1 level. After TP3 → trail moves to TP2.
👁️ Reading the chart:
— 🟢 Green EMA ribbon fill = bullish momentum (fast > slow)
— 🔴 Red EMA ribbon fill = bearish momentum
— ⚫ Dot-style line = EMA Trend (55) — macro direction filter
— 🟢 "Long" label below bar = confirmed buy signal
— 🔴 "Short" label above bar = confirmed sell signal
— 🔵 Blue solid line = entry price
— 🔴 Red solid line = stop loss
— 🟢 Green dashed lines = TP1, TP2, TP3
— 🟠 Orange dotted line = trailing stop (updates after each TP hit)
📊 Dashboard fields:
— Trend: current EMA alignment (Bullish / Bearish / Neutral)
— Score: confluence score (e.g., "7.5 / 10")
— Status: trade state (Active / TP1 ✓ — Trail / TP2 ✓ — Trail / No Trade)
— HTF Bias: higher-timeframe trend (Bullish / Bearish / Neutral)
— Volatility: regime (High / Normal / Low)
— RSI, ADX: current values
— Timeframe, preset, version
🔧 Tuning guide:
— Too many signals: increase Min Score (6–8), use Conservative preset, set HTF filter to a higher TF
— Too few signals: decrease Min Score (3–4), use Aggressive preset
— Stops too tight: increase SL ATR Multiplier (2.0–2.5), increase Swing Lookback (12–20)
— Stops too wide: decrease SL ATR Multiplier (1.0), enable Structure-Based SL
— Scalping 1–5M: Scalping preset, EMA Fast 5/Slow 13/Trend 34, TP1 0.75/TP2 1.5/TP3 2.5
— Swing 4H–1D: Conservative preset, EMA Fast 12/Slow 26/Trend 100, TP3 5.0+
⚙️ KEY SETTINGS REFERENCE
⚙️ Main:
— HTF Trend Filter (default current TF): higher timeframe for bias. Leave empty = disabled.
— Preset (default Default): Conservative / Default / Aggressive / Scalping
🎯 Entry Engine:
— EMA Fast (default 9) / Slow (default 21) / Trend (default 55)
— Min Confluence Score (default 5): minimum score out of 10 to trigger signal
— RSI Length (default 13)
🛡️ Risk Management:
— ATR Length (default 14) / SL ATR Multiplier (default 1.5)
— TP1/TP2/TP3 R:R (default 1.0 / 2.0 / 3.0)
— Trailing Stop (default On): ratchets SL to BE after TP1, to TP1 after TP2
— Structure-Based SL (default On): recent swing low/high as stop anchor
— Swing Lookback (default 10): bars for structure SL detection
🎨 Visual:
— EMA ribbon, TP/SL lines, trailing stop line, background tint (all toggleable)
— Configurable signal label size (Tiny–Huge)
— Auto / Dark / Light theme
🔔 Alerts
— 🟢 BUY / 🔴 SELL — ticker, price, SL, TP1, TP2, TP3, score, timeframe
— 🎯 TP1 HIT / TP2 HIT / 🏆 TP3 HIT — trade progress
— 🛑 SL HIT — stopped out
All support plain text and JSON webhook format. Bar-close confirmed.
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All signals require barstate.isconfirmed. HTF data uses [1] + lookahead_on for non-repainting values. TP/SL hits are checked only on bars after the entry bar (canCheckTPSL = bar_index > entryBar). A warmup period (max of EMA Trend length and 50 bars) prevents signals during insufficient data.
— 📐 The confluence score is not a win-rate predictor. A score of 8/10 means eight market dimensions agree on direction — it measures consensus quality. Higher scores correlate with stronger setups but do not guarantee outcomes.
— ⚖️ Structure-based SL picks the tighter of structure vs ATR stop — not the wider one. This means your actual risk per trade may be less than SL ATR Multiplier × ATR. Check the SL label on each trade for the actual stop level.
— 🔒 The trailing stop uses pre-update values for SL hit detection. If TP1 is hit and the trail moves to breakeven on the same bar, the SL check uses the old trail value — preventing false same-bar stop-outs.
— 📊 VWAP factor auto-falls back to close on instruments where ta.vwap returns na. Volume factor auto-passes (returns true) on instruments without volume data.
— 🔄 If buy and sell trigger simultaneously (extremely rare edge case), buy takes priority and the sell is suppressed.
— 🛠️ This is a signal and risk management tool, not an automated trading bot. It scores confluence, generates signals, places targets, and trails stops — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. All factors auto-adapt to available data.
The core principle: instead of using a single crossover or oscillator reading to trigger a signal, this indicator requires multiple independent market dimensions to agree simultaneously. An EMA crossover alone can produce false signals in choppy markets. RSI confirmation alone can be early or late. Volume alone doesn't tell you direction. But when EMA alignment + RSI momentum + MACD direction + VWAP position + volume + ADX + DI + HTF trend all point the same way — and the composite score exceeds your threshold — the probability of a genuine directional move is significantly higher than any single factor alone.
🧩 WHY THESE COMPONENTS WORK TOGETHER
Each factor in the scoring engine measures a different market dimension:
— EMA Fast/Slow crossover → detects the momentum shift that initiates the signal (trigger)
— EMA Trend → confirms the macro direction (structural filter)
— RSI → confirms momentum is in the non-extreme zone (avoids overbought entries)
— MACD histogram + MACD vs signal → confirms momentum is accelerating, not decelerating (2 factors)
— VWAP position → confirms price is on the right side of institutional fair value
— Volume → confirms market participation (not a low-liquidity wick)
— ADX + DI → confirms the market is trending AND directional pressure aligns (not ranging)
— HTF EMA bias → confirms the higher-timeframe trend agrees with the entry direction
These factors are deliberately orthogonal: EMA alignment can occur without volume, MACD can be bullish without RSI confirming, price can be above VWAP while ADX shows no trend. The scoring engine counts how many factors agree — only when enough dimensions align does the signal pass.
The entry signal feeds into the risk management system: structure-based SL provides a structurally meaningful stop (recent swing low/high), the R:R-based TPs create consistent reward targets, and the progressive trailing stop automatically manages the trade after entry — ratcheting protection as each target is hit. Without the trailing system, a signal that hits TP1 can still reverse to SL for a full loss. With it, after TP1 the worst case is breakeven.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ 10-factor confluence scoring engine (0–10 scale).
Every bar, both a bullish and bearish score are computed from 10 independent factors:
Bullish score calculation:
— 📐 EMA Fast > EMA Slow → +1.0 (short-term momentum is upward)
— 📏 Close > EMA Trend → +1.0 (price is above macro trend)
— 📊 RSI > 50 AND RSI < 75 → +1.0 (momentum is bullish but not overbought)
— 📈 MACD Histogram > 0 → +1.0 (momentum is positive)
— 📈 MACD Line > Signal Line → +1.0 (MACD has bullish crossover)
— ⚖️ Close > VWAP → +1.0 (price above institutional fair value)
— 📊 Volume > SMA(20) × 1.2 → +1.0 (above-average participation)
— 💪 ADX > 20 AND +DI > −DI → +1.0 (trending market with bullish pressure)
— 🌐 HTF EMA Fast > HTF EMA Slow → +1.5 (higher timeframe confirms direction)
— ✅ Close > EMA Fast → +0.5 (price is above the fast MA — minor confirmation)
Maximum bullish score: 10.0. Bearish score uses symmetric conditions (< instead of >, −DI > +DI, etc.). The HTF factor carries 1.5× weight because higher-timeframe alignment is the single strongest predictor of signal quality. The close > EMA Fast factor carries 0.5× because it's partially redundant with the crossover — it adds a minor confirmation that price didn't just touch the crossover but is clearly above it.
A signal fires when: EMA crossover occurs + price is on the correct side of both EMAs + RSI is not extreme + composite score ≥ Min Confluence Score (default 5 out of 10).
2️⃣ Structure-based stop loss with ATR fallback.
When enabled (default on), the stop loss is placed at the most structurally meaningful level:
For long trades:
— structureStop = recent swing low (over configurable lookback, default 10 bars) − 0.2× ATR padding
— atrStop = entry − ATR × SL multiplier
— finalStop = max(structureStop, atrStop) — the HIGHER (tighter) of the two
This "pick the tighter stop" logic ensures the SL is always at a meaningful structural level but never further than the ATR-based maximum. A minimum distance of 0.5× ATR is enforced to prevent unrealistically tight stops when the swing low is very close to entry.
For short trades: symmetric logic with min() instead of max(), swing high + padding.
When structure SL is disabled, the stop uses pure ATR: SL = entry ± ATR × multiplier.
3️⃣ Progressive trailing stop system.
After entry, the stop ratchets progressively as targets are hit:
— Initial state: SL at structure/ATR level
— After TP1 hit: SL moves to entry price (breakeven) — worst case is now 0 loss
— After TP2 hit: SL moves to TP1 level — worst case is now TP1 profit locked
— After TP3 hit: SL moves to TP2 level — TP2 profit locked, runner continues
The trailing stop line updates dynamically on the chart (orange dotted line with label). The SL hit check uses the pre-update trail value to prevent same-bar conflicts: if TP1 and the trail are both touched on the same candle, the TP1 hit processes first, then the trail is checked against its PRE-move value.
This progressive system means that once a trade reaches TP1, it can only end in breakeven or profit — never a loss. After TP2, the minimum outcome is TP1 profit locked.
4️⃣ Four presets with parameter scaling.
Each preset adjusts two key parameters:
— Conservative: min score floor 7/10, SL floor 2.0× ATR — requires strong consensus, wider stop
— Default: uses your manual settings
— Aggressive: min score ceiling 3/10, manual SL — accepts lighter consensus
— Scalping: min score ceiling 4/10, SL ceiling 1.0× ATR — lower bar, tighter stop
The preset modifies the effective score threshold and SL multiplier — the underlying 10 factors don't change, only how many must agree and how wide the stop is.
5️⃣ Volatility regime detection.
The dashboard displays the current volatility regime: volRatio = ATR(14) / SMA(ATR, 42). High (ratio > 1.3) = volatility above average — consider wider stops. Low (ratio < 0.7) = volatility compressed — watch for breakout. Normal = standard conditions. This provides at-a-glance context for how the current environment affects your settings.
6️⃣ EMA ribbon with macro trend overlay.
Three EMAs create a visual trend system:
— EMA Fast (default 9) = short-term momentum direction
— EMA Slow (default 21) = medium-term trend
— EMA Trend (default 55) = macro trend filter (shown as dot-style line)
The fast/slow ribbon fills green when fast > slow (bullish momentum) and red when fast < slow. Signals only fire when the EMA crossover occurs AND price confirms by closing on the correct side of both EMAs.
7️⃣ RSI extreme avoidance.
The signal engine requires RSI to be in a non-extreme zone: bullish signals require RSI > 50 AND < 75 (not overbought). Bearish signals require RSI < 50 AND > 25 (not oversold). This prevents the most common failure mode of momentum-based entries: buying into an already overbought market or selling into an oversold bounce.
8️⃣ Direction lock — one signal per trend leg.
After a buy signal fires, the next signal can only be a sell (and vice versa). This prevents signal clustering during strong trends where the confluence score might cross the threshold multiple times. If both buy and sell trigger on the same bar (rare edge case), buy takes priority (mutual exclusion).
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — Core indicators: EMA Fast(9), EMA Slow(21), EMA Trend(55), RSI(13), MACD(12/26/9), VWAP(hlc3), Volume SMA(20), ADX/DI(14), HTF EMAs via request.security with [1] + lookahead_on.
Step 2 — Confluence scoring: 10 factors evaluated independently for both bullish and bearish directions. Each factor adds its weight (1.0, 1.5, or 0.5) to the composite score. Max score = 10.0 per direction.
Step 3 — Signal trigger: EMA crossover (fast crosses slow) + price above/below both EMAs + RSI not extreme + composite score ≥ threshold + direction lock → confirmed signal on barstate.isconfirmed.
Step 4 — SL calculation: Structure mode: recent swing low/high ± 0.2× ATR padding, then pick the tighter of structure vs ATR stop. Minimum distance enforced at 0.5× ATR. Risk = |entry − SL|.
Step 5 — TP placement: TP1 = entry ± risk × tp1RR, TP2 = entry ± risk × tp2RR, TP3 = entry ± risk × tp3RR.
Step 6 — Trade monitoring: Each bar: check TP1/TP2/TP3 hits → ratchet trailing stop. Check SL hit against pre-ratchet trail value. Update visual lines and labels.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator — the EMA ribbon appears showing current trend
2. Select a preset (Conservative for swing, Scalping for 1–5M)
3. Wait for a "Long" or "Short" label — check the dashboard for score
4. Entry, SL, TP1, TP2, TP3 lines appear automatically
5. After TP1 → orange trailing stop line moves to breakeven
6. After TP2 → trail moves to TP1 level. After TP3 → trail moves to TP2.
👁️ Reading the chart:
— 🟢 Green EMA ribbon fill = bullish momentum (fast > slow)
— 🔴 Red EMA ribbon fill = bearish momentum
— ⚫ Dot-style line = EMA Trend (55) — macro direction filter
— 🟢 "Long" label below bar = confirmed buy signal
— 🔴 "Short" label above bar = confirmed sell signal
— 🔵 Blue solid line = entry price
— 🔴 Red solid line = stop loss
— 🟢 Green dashed lines = TP1, TP2, TP3
— 🟠 Orange dotted line = trailing stop (updates after each TP hit)
📊 Dashboard fields:
— Trend: current EMA alignment (Bullish / Bearish / Neutral)
— Score: confluence score (e.g., "7.5 / 10")
— Status: trade state (Active / TP1 ✓ — Trail / TP2 ✓ — Trail / No Trade)
— HTF Bias: higher-timeframe trend (Bullish / Bearish / Neutral)
— Volatility: regime (High / Normal / Low)
— RSI, ADX: current values
— Timeframe, preset, version
🔧 Tuning guide:
— Too many signals: increase Min Score (6–8), use Conservative preset, set HTF filter to a higher TF
— Too few signals: decrease Min Score (3–4), use Aggressive preset
— Stops too tight: increase SL ATR Multiplier (2.0–2.5), increase Swing Lookback (12–20)
— Stops too wide: decrease SL ATR Multiplier (1.0), enable Structure-Based SL
— Scalping 1–5M: Scalping preset, EMA Fast 5/Slow 13/Trend 34, TP1 0.75/TP2 1.5/TP3 2.5
— Swing 4H–1D: Conservative preset, EMA Fast 12/Slow 26/Trend 100, TP3 5.0+
⚙️ KEY SETTINGS REFERENCE
⚙️ Main:
— HTF Trend Filter (default current TF): higher timeframe for bias. Leave empty = disabled.
— Preset (default Default): Conservative / Default / Aggressive / Scalping
🎯 Entry Engine:
— EMA Fast (default 9) / Slow (default 21) / Trend (default 55)
— Min Confluence Score (default 5): minimum score out of 10 to trigger signal
— RSI Length (default 13)
🛡️ Risk Management:
— ATR Length (default 14) / SL ATR Multiplier (default 1.5)
— TP1/TP2/TP3 R:R (default 1.0 / 2.0 / 3.0)
— Trailing Stop (default On): ratchets SL to BE after TP1, to TP1 after TP2
— Structure-Based SL (default On): recent swing low/high as stop anchor
— Swing Lookback (default 10): bars for structure SL detection
🎨 Visual:
— EMA ribbon, TP/SL lines, trailing stop line, background tint (all toggleable)
— Configurable signal label size (Tiny–Huge)
— Auto / Dark / Light theme
🔔 Alerts
— 🟢 BUY / 🔴 SELL — ticker, price, SL, TP1, TP2, TP3, score, timeframe
— 🎯 TP1 HIT / TP2 HIT / 🏆 TP3 HIT — trade progress
— 🛑 SL HIT — stopped out
All support plain text and JSON webhook format. Bar-close confirmed.
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All signals require barstate.isconfirmed. HTF data uses [1] + lookahead_on for non-repainting values. TP/SL hits are checked only on bars after the entry bar (canCheckTPSL = bar_index > entryBar). A warmup period (max of EMA Trend length and 50 bars) prevents signals during insufficient data.
— 📐 The confluence score is not a win-rate predictor. A score of 8/10 means eight market dimensions agree on direction — it measures consensus quality. Higher scores correlate with stronger setups but do not guarantee outcomes.
— ⚖️ Structure-based SL picks the tighter of structure vs ATR stop — not the wider one. This means your actual risk per trade may be less than SL ATR Multiplier × ATR. Check the SL label on each trade for the actual stop level.
— 🔒 The trailing stop uses pre-update values for SL hit detection. If TP1 is hit and the trail moves to breakeven on the same bar, the SL check uses the old trail value — preventing false same-bar stop-outs.
— 📊 VWAP factor auto-falls back to close on instruments where ta.vwap returns na. Volume factor auto-passes (returns true) on instruments without volume data.
— 🔄 If buy and sell trigger simultaneously (extremely rare edge case), buy takes priority and the sell is suppressed.
— 🛠️ This is a signal and risk management tool, not an automated trading bot. It scores confluence, generates signals, places targets, and trails stops — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. All factors auto-adapt to available data.
Release Notes
🧠 Auto-Preset by TimeframeNew "Auto" mode automatically selects the best preset for your current timeframe:
— ≤ 5 min → Scalping (fast EMAs, tight stops, low score threshold)
— 6–60 min → Default (balanced settings)
— 1H–4H → Aggressive (responsive entries)
— 4H+ → Swing (wide stops, deep trend EMAs)
Dashboard shows the resolved preset: "Auto → Scalping", "Auto → Swing", etc. Just set it and forget — the indicator configures itself.
📊 Built-in Backtest Tracker
New dashboard section "📈 Backtest" tracks every completed trade in real time:
— Trades: total count with wins/losses breakdown (e.g., "12 (8W / 4L)")
— Win Rate: percentage of trades that hit TP1 before SL
— Avg R: average risk-multiple return per trade — shows how many R's each trade delivers on average
— Profit Factor: gross wins / gross losses — above 1.5 is strong, below 1.0 is losing
— Total R: cumulative R earned across all tracked trades
A trade closes when SL is hit or a new opposing signal fires. R is calculated based on the best TP reached: TP3 hit = tp3Mult R, TP2 = tp2Mult R, TP1 = tp1Mult R, no TP = −1R. If closed by opposing signal before any TP, the actual P/L in R terms is estimated from the exit price.
Toggle with "Show Backtest Stats" in Dashboard settings.
🎯 Extended Presets — Swing & Crypto 24/7
Two new presets added:
— Swing: EMA 13/34/89, RSI 21, ATR 20, SL 2.5×, Score 6 — optimized for 4H–Daily charts with wider stops and deeper trend confirmation
— Crypto 24/7: EMA 9/21/55, RSI 14, ATR 20, SL 2.0×, Score 5 — no session bias, wider stops for 24/7 markets, balanced sensitivity
⚙️ Full Profile Presets
Presets now override ALL core parameters — not just score and SL multiplier:
— EMA Fast / Slow / Trend lengths
— RSI length
— ATR length
— Min Confluence Score
— SL ATR Multiplier
Each preset is a complete tuning profile. Select "Custom" to use all manual settings as-is.
Complete preset table:
— Scalping: EMA 5/13/34, RSI 8, ATR 10, Score 4, SL 0.8×
— Aggressive: EMA 8/18/50, RSI 11, ATR 12, Score 3, SL 1.2×
— Default: EMA 9/21/55, RSI 13, ATR 14, Score 5, SL 1.5×
— Conservative: EMA 12/26/89, RSI 14, ATR 14, Score 7, SL 2.0×
— Swing: EMA 13/34/89, RSI 21, ATR 20, Score 6, SL 2.5×
— Crypto 24/7: EMA 9/21/55, RSI 14, ATR 20, Score 5, SL 2.0×
🏆 Signal Quality Grades
Signals now display a quality grade based on confluence score:
— A+ (score ≥ 8.0): highest confidence — most factors aligned
— A (score ≥ 6.5): strong setup
— B (score ≥ 5.0): acceptable quality
— C (score < 5.0): marginal — only if score passes minimum threshold
Labels show "Long A+" / "Short B" etc. Toggle with "Show Signal Grade" in Visual settings. Alerts include the grade in both text and JSON format.
🔧 Minor Improvements
— Configurable label offset for TP/SL (default 20 bars right of entry) — keeps labels from overlapping with price action
— Dashboard text colors adapted for light theme — uses darker saturated variants (dark green, dark red) instead of neon colors that wash out on white backgrounds
— Alerts now include grade and resolved preset in JSON payload
Release Notes
🆕 New Features🎚 Signal Grade Filter
You can now filter signals by their quality grade directly from the settings:
🟢 All — show every valid signal (A+, A, B)
🟡 A+ and A — only high-quality setups (score ≥ 6.5)
🔥 A+ Only — premium signals only (score ≥ 8.0)
Perfect for comparing aggressive vs. selective approaches on the same chart. Pro tip: run the backtest tracker on each mode to see which grade level gives you the best edge on your instrument. 📊
🚫 Hide C-Grade Signals Toggle
A dedicated checkbox to filter out weak signals (score < 5.0) regardless of your preset. Especially useful with Aggressive/Scalping presets where low-quality signals could previously sneak through. Enabled by default for cleaner charts. ✨
📋 Dashboard Enhancement
New Grade Filter row in the dashboard so you always see which filtering mode is active at a glance. Color-coded: green for A+ Only, yellow for A+ and A, neutral for All. 🎨
🛠 Critical Bug Fixes
🐛 Backtest Tracker: Honest Trailing Stop Accounting
This one's important. The previous version was overestimating your profits when trailing stop was enabled. Here's the deal:
When price hits TP3 and the trail moves to TP2, then price reverses and hits the trail — you actually exited at TP2 (+2R), not TP3 (+3R). The old code was crediting the full TP3. Same issue for TP2→TP1 and TP1→breakeven.
✅ Now fixed: With trailing ON, the tracker correctly reports the realized R based on where the trail was actually parked. Your Profit Factor and Avg R numbers are now the real deal. 💯
🐛 Double-Counted Trade Closures
When a stop-loss and an opposing signal happened on the same bar, the tracker could partially double-process the trade and overwrite the realized R. ✅ Fixed: closure cases are now mutually exclusive (SL priority), ensuring every trade is counted exactly once with the correct P&L. 🎯
🐛 Blocked Re-Entries After Stop-Outs
Previously, if a long trade got stopped out and a fresh bullish signal appeared 10 bars later, the indicator would ignore it because the direction-lock logic was never released. This was silently costing valid signals in trending markets with pullbacks.
✅ Fixed: The direction lock now resets when a trade closes by stop-loss. Clean stop-out → fresh signal → you're back in the game. 🔄
📈 What This Means for You
➖ More trustworthy backtest numbers — if your PF was 2.5 before, the real number was probably lower. Now you see the truth, which means better decision-making. 🎯
Better signal hygiene — the grade filter lets you quickly A/B test quality thresholds without touching other settings.
➖ No more missed entries — trending markets with multiple stop-outs and re-entries now work as they should. 📊
➖ Same core engine — all the confluence scoring, HTF bias, auto-preset, and risk management you already know. Nothing about the entry logic itself changed. 🛡
Release Notes
🚀 UPDATE v1.2.4 — GRANULAR ALERT CONDITIONS═════════════════════════════════════════════════════════════
This release adds dedicated alert conditions for every signal type,
so you can subscribe to exactly what you want in TradingView's
"Create Alert" dialog — without custom messages or external filtering.
─────────────────────────────────────────────────────────────
WHAT'S NEW
─────────────────────────────────────────────────────────────
▸ DIRECTION-SPECIFIC ALERTS
Create alerts for BUY only or SELL only instead of getting
both directions in a single combined alert.
▸ GRADE-FILTERED ALERT VARIANTS
Each direction comes with three quality tiers:
• Buy/Sell Signal (A+ only) → score ≥ 8.0
• Buy/Sell Signal (A+ and A) → score ≥ 6.5
• Buy/Sell Signal (A+ and A and B) → score ≥ 5.0
These apply their own threshold independently of the in-script
"Signal Grade Filter" input — so you can keep the chart on "All"
visually but only get push alerts for A+ setups.
▸ TP/SL EVENTS AS INDIVIDUAL CONDITIONS
TP1, TP2, TP3, and SL hits are now exposed as separate alert
conditions — useful for partial-close automation or webhook
routing where each event needs its own alert.
▸ "ANY SIGNAL" COMBINED CONDITION
Kept for users who want a single alert covering both directions.
─────────────────────────────────────────────────────────────
FULL LIST OF NEW ALERT CONDITIONS
─────────────────────────────────────────────────────────────
🟢 Buy Signal
🔴 Sell Signal
🟢 Buy Signal (A+ only)
🔴 Sell Signal (A+ only)
🟢 Buy Signal (A+ and A)
🔴 Sell Signal (A+ and A)
🟢 Buy Signal (A+ and A and B)
🔴 Sell Signal (A+ and A and B)
🎯 TP1 Hit
🎯 TP2 Hit
🏆 TP3 Hit
🛑 SL Hit
⚡ Any Signal (Buy or Sell)
─────────────────────────────────────────────────────────────
BACKWARDS COMPATIBILITY
─────────────────────────────────────────────────────────────
The legacy alert() calls used by the "Any alert() function call"
option in TradingView are FULLY PRESERVED. If you've already set
up alerts that way (including JSON webhooks via the "Webhook JSON
Format" toggle), nothing breaks — they keep working as before.
─────────────────────────────────────────────────────────────
HOW TO USE
─────────────────────────────────────────────────────────────
1. Right-click the chart → Add alert (or click the alarm icon)
2. Condition → Precision Sniper [WillyAlgoTrader]
3. Pick the specific signal type from the dropdown
(e.g. "🔴 Sell Signal (A+ only)")
4. Configure delivery (popup / email / webhook / mobile push)
5. Save
─────────────────────────────────────────────────────────────
TIPS
─────────────────────────────────────────────────────────────
▸ Default messages use TradingView placeholders ({{ticker}},
{{close}}, {{interval}}) — you can fully rewrite them in the
alert dialog to match your webhook format.
▸ Cleanest workflow: leave the chart's "Signal Grade Filter" on
"All" to see every setup visually, then use the grade-filtered
alert conditions to only get notified about the quality level
you actually trade.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
10 years in trading. For all inquiries, contact me on my Telegram channel: t.me/WillyAlgoTrader or Instagram: @willytraderbtc
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.