PROTECTED SOURCE SCRIPT
更新済 SFP SCANNERV2

==============================
📌 SFP SCANNER — QUICK GUIDE (EN)
==============================
🎯 Goal
Automatically scan Swing Failure Patterns (SFPs) on pivot-based support and resistance levels, using a multi-timeframe, structural and filterable approach.
👉 This indicator is designed to be mainly used with alerts on watchlists.
The more permissive the filters are, the more signals (and noise) you will get.
--------------------------------------------------
🧱 1) Pivot Levels — Pivot Timeframe
--------------------------------------------------
Levels are built using classic pivots.
Settings:
• Pivot timeframe: timeframe used to compute pivots (e.g. 4H)
• Pivot source:
- Wicks = highs / lows
- Closes = closing prices
• Left / Right: number of bars required to validate a pivot
➡️ A pivot is confirmed only after “Right” bars.
👉 Recommendation: minimum 15 / 15 on H4.
--------------------------------------------------
🎨 Level Display
--------------------------------------------------
• Pivot High → resistances
• Pivot Low → supports
• Colors, width and style are visual-only settings
--------------------------------------------------
📍 2) SFP Detection — Counting Timeframe
--------------------------------------------------
SFPs are detected on the “Counting timeframe”, regardless of the chart timeframe.
Bearish SFP (resistance):
1) Close above the level (breakout)
2) Close back below the level (reclaim)
3) Breakout duration must respect:
- Min bars breakout
- Max bars breakout
(counted in counting timeframe bars)
Bullish SFP (support):
Mirrored logic:
1) Break below
2) Reclaim above
3) Min / Max bars respected
--------------------------------------------------
🧠 3) Trend Filter — Moving Averages (optional)
--------------------------------------------------
If enabled:
• MA50 > MA200 → only Bullish SFPs allowed
• MA50 < MA200 → only Bearish SFPs allowed
Settings:
• MA timeframe:
- Blank = counting timeframe
- Recommended: pivot timeframe
• MA type: SMA or EMA
• Fast / Slow MA: default 50 / 200
--------------------------------------------------
🧱 4) Structural Support / Resistance Filter
--------------------------------------------------
This filter is independent from the MA filter.
Structure pivots count (N):
• Number of consecutive supports / resistances used to validate structure.
Checkbox logic (restrictive):
👉 If no checkbox is selected → all SFPs are allowed.
Bullish SFPs allowed if:
• Supports are rising
• Resistances are rising
Bearish SFPs allowed if:
• Resistances are falling
• Supports are falling
➡️ Each checkbox acts as an independent restriction.
At least one selected condition must be true to allow the SFP.
--------------------------------------------------
🛑 5) Anti-spam
--------------------------------------------------
• One-shot per level
➡️ Once triggered, the level is considered consumed.
--------------------------------------------------
🔎 6) Levels to Scan
--------------------------------------------------
• Number of recent pivot levels (supports + resistances) checked for SFP detection.
--------------------------------------------------
🕒 7) Multi-timeframe Display
--------------------------------------------------
Regardless of the chart timeframe:
• Chart > Counting timeframe:
A lower-timeframe SFP is displayed on the higher-timeframe candle.
• Chart = Counting timeframe:
The SFP appears directly on the candle at close.
• Chart < Counting timeframe:
The signal is displayed at the opening of the next counting timeframe candle.
--------------------------------------------------
🔔 TradingView Alerts
--------------------------------------------------
• Bullish SFP
• Bearish SFP
--------------------------------------------------
⚙️ Suggested Settings (Day trading / 1–2 day swing)
--------------------------------------------------
• Pivot timeframe: 4H
• Counting timeframe: 15m (or 5m for more signals)
• Levels to scan: 1 to 2
• Structure pivots count (N): 2 to 3
• Min bars breakout: 2 to 3
• Max bars breakout: 5 to 10
✅ Happy scanning and good trades! 😄
📌 SFP SCANNER — QUICK GUIDE (EN)
==============================
🎯 Goal
Automatically scan Swing Failure Patterns (SFPs) on pivot-based support and resistance levels, using a multi-timeframe, structural and filterable approach.
👉 This indicator is designed to be mainly used with alerts on watchlists.
The more permissive the filters are, the more signals (and noise) you will get.
--------------------------------------------------
🧱 1) Pivot Levels — Pivot Timeframe
--------------------------------------------------
Levels are built using classic pivots.
Settings:
• Pivot timeframe: timeframe used to compute pivots (e.g. 4H)
• Pivot source:
- Wicks = highs / lows
- Closes = closing prices
• Left / Right: number of bars required to validate a pivot
➡️ A pivot is confirmed only after “Right” bars.
👉 Recommendation: minimum 15 / 15 on H4.
--------------------------------------------------
🎨 Level Display
--------------------------------------------------
• Pivot High → resistances
• Pivot Low → supports
• Colors, width and style are visual-only settings
--------------------------------------------------
📍 2) SFP Detection — Counting Timeframe
--------------------------------------------------
SFPs are detected on the “Counting timeframe”, regardless of the chart timeframe.
Bearish SFP (resistance):
1) Close above the level (breakout)
2) Close back below the level (reclaim)
3) Breakout duration must respect:
- Min bars breakout
- Max bars breakout
(counted in counting timeframe bars)
Bullish SFP (support):
Mirrored logic:
1) Break below
2) Reclaim above
3) Min / Max bars respected
--------------------------------------------------
🧠 3) Trend Filter — Moving Averages (optional)
--------------------------------------------------
If enabled:
• MA50 > MA200 → only Bullish SFPs allowed
• MA50 < MA200 → only Bearish SFPs allowed
Settings:
• MA timeframe:
- Blank = counting timeframe
- Recommended: pivot timeframe
• MA type: SMA or EMA
• Fast / Slow MA: default 50 / 200
--------------------------------------------------
🧱 4) Structural Support / Resistance Filter
--------------------------------------------------
This filter is independent from the MA filter.
Structure pivots count (N):
• Number of consecutive supports / resistances used to validate structure.
Checkbox logic (restrictive):
👉 If no checkbox is selected → all SFPs are allowed.
Bullish SFPs allowed if:
• Supports are rising
• Resistances are rising
Bearish SFPs allowed if:
• Resistances are falling
• Supports are falling
➡️ Each checkbox acts as an independent restriction.
At least one selected condition must be true to allow the SFP.
--------------------------------------------------
🛑 5) Anti-spam
--------------------------------------------------
• One-shot per level
➡️ Once triggered, the level is considered consumed.
--------------------------------------------------
🔎 6) Levels to Scan
--------------------------------------------------
• Number of recent pivot levels (supports + resistances) checked for SFP detection.
--------------------------------------------------
🕒 7) Multi-timeframe Display
--------------------------------------------------
Regardless of the chart timeframe:
• Chart > Counting timeframe:
A lower-timeframe SFP is displayed on the higher-timeframe candle.
• Chart = Counting timeframe:
The SFP appears directly on the candle at close.
• Chart < Counting timeframe:
The signal is displayed at the opening of the next counting timeframe candle.
--------------------------------------------------
🔔 TradingView Alerts
--------------------------------------------------
• Bullish SFP
• Bearish SFP
--------------------------------------------------
⚙️ Suggested Settings (Day trading / 1–2 day swing)
--------------------------------------------------
• Pivot timeframe: 4H
• Counting timeframe: 15m (or 5m for more signals)
• Levels to scan: 1 to 2
• Structure pivots count (N): 2 to 3
• Min bars breakout: 2 to 3
• Max bars breakout: 5 to 10
✅ Happy scanning and good trades! 😄
リリースノート
==============================📌 SFP SCANNER — QUICK GUIDE (EN)
==============================
🎯 Goal
Automatically scan Swing Failure Patterns (SFPs) on pivot-based support and resistance levels, using a multi-timeframe, structural and filterable approach.
👉 This indicator is designed to be mainly used with alerts on watchlists.
The more permissive the filters are, the more signals (and noise) you will get.
--------------------------------------------------
🧱 1) Pivot Levels — Pivot Timeframe
--------------------------------------------------
Levels are built using classic pivots.
Settings:
• Pivot timeframe: timeframe used to compute pivots (e.g. 4H)
• Pivot source:
- Wicks = highs / lows
- Closes = closing prices
• Left / Right: number of bars required to validate a pivot
➡️ A pivot is confirmed only after “Right” bars.
👉 Recommendation: minimum 15 / 15 on H4.
--------------------------------------------------
🎨 Level Display
--------------------------------------------------
• Pivot High → resistances
• Pivot Low → supports
• Colors, width and style are visual-only settings
--------------------------------------------------
📍 2) SFP Detection — Counting Timeframe
--------------------------------------------------
SFPs are detected on the “Counting timeframe”, regardless of the chart timeframe.
Bearish SFP (resistance):
1) Close above the level (breakout)
2) Close back below the level (reclaim)
3) Breakout duration must respect:
- Min bars breakout
- Max bars breakout
(counted in counting timeframe bars)
Bullish SFP (support):
Mirrored logic:
1) Break below
2) Reclaim above
3) Min / Max bars respected
--------------------------------------------------
🧠 3) Trend Filter — Moving Averages (optional)
--------------------------------------------------
If enabled:
• MA50 > MA200 → only Bullish SFPs allowed
• MA50 < MA200 → only Bearish SFPs allowed
Settings:
• MA timeframe:
- Blank = counting timeframe
- Recommended: pivot timeframe
• MA type: SMA or EMA
• Fast / Slow MA: default 50 / 200
--------------------------------------------------
🧱 4) Structural Support / Resistance Filter
--------------------------------------------------
This filter is independent from the MA filter.
Structure pivots count (N):
• Number of consecutive supports / resistances used to validate structure.
Checkbox logic (restrictive):
👉 If no checkbox is selected → all SFPs are allowed.
Bullish SFPs allowed if:
• Supports are rising
• Resistances are rising
Bearish SFPs allowed if:
• Resistances are falling
• Supports are falling
➡️ Each checkbox acts as an independent restriction.
At least one selected condition must be true to allow the SFP.
--------------------------------------------------
🛑 5) Anti-spam
--------------------------------------------------
• One-shot per level
➡️ Once triggered, the level is considered consumed.
--------------------------------------------------
🔎 6) Levels to Scan
--------------------------------------------------
• Number of recent pivot levels (supports + resistances) checked for SFP detection.
--------------------------------------------------
🕒 7) Multi-timeframe Display
--------------------------------------------------
Regardless of the chart timeframe:
• Chart > Counting timeframe:
A lower-timeframe SFP is displayed on the higher-timeframe candle.
• Chart = Counting timeframe:
The SFP appears directly on the candle at close.
• Chart < Counting timeframe:
The signal is displayed at the opening of the next counting timeframe candle.
--------------------------------------------------
🔔 TradingView Alerts
--------------------------------------------------
• Bullish SFP
• Bearish SFP
--------------------------------------------------
⚙️ Suggested Settings (Day trading / 1–2 day swing)
--------------------------------------------------
• Pivot timeframe: 4H
• Counting timeframe: 15m (or 5m for more signals)
• Levels to scan: 1 to 2
• Structure pivots count (N): 2 to 3
• Min bars breakout: 2 to 3
• Max bars breakout: 5 to 10
✅ Happy scanning and good trades! 😄
リリースノート
**SFP SCANNER (v3) — Documentation**📌 **Goal / use-case**
- Scan **SFP (Swing Failure Pattern)** events on structural pivot levels (support/resistance) computed on a higher “pivot timeframe” (e.g., 4H, D, W).
- Designed to **scan large watchlists**: you set pivot TF + counting TF, then you can switch chart TF without losing signals.
---
## 1) Pivot levels (structure)
⚙️ **Pivot timeframe (TF Pivots)**
- Timeframe used to build pivot supports/resistances.
⚙️ **Pivot source**
- **Wicks** = pivots based on highs/lows.
- **Close** = pivots based on closes.
⚙️ **Left / Right bars**
- Pivot sensitivity:
- **Left** = bars to the left
- **Right** = bars to the right (pivot confirmed after these bars)
➡️ Higher values = cleaner but fewer pivots.
🎨 **Line styling**
- Separate color/width/style for supports and resistances.
---
## 2) SFP detection (Counting timeframe)
⚙️ **Counting timeframe (TF Count)**
- The SFP logic is computed on **TF Count** (e.g., 15m, 5m, 1h) even if your chart is 4H/D/etc.
- TF Count signals are then “projected” on the current chart timeframe.
✅ **Definition (quick)**
- **Bullish SFP (support)**: price pierces **below support** then **reclaims** (close back above).
- **Bearish SFP (resistance)**: price pierces **above resistance** then **reclaims** (close back below).
---
## 3) Breakout duration filter (Min/Max bars breakout)
⚙️ **Min bars breakout** & **Max bars breakout**
➡️ Counts how many **TF Count** candles close **outside** the level before reclaiming.
- **If Min bars breakout ≥ 1**
➜ Requires a “confirmed” breakout (one or more closes outside) for at least **Min** bars, then a reclaim (opposite close) within **Max** bars.
- **If Min bars breakout = 0** ✅
➜ Also detects **wick-only SFPs**:
- wick breaks the level (high/low) **without a close outside**,
- then the **TF Count candle closes back inside** the level.
👉 Useful for quick stop-hunts (e.g., 20 minutes outside then back in, without any TF Count close outside).
---
## 4) MA trend filter (optional)
⚙️ **MA timeframe + MA type (EMA/SMA) + lengths**
- Can be used as a strict direction filter:
- **Longs only** if MA fast > MA slow
- **Shorts only** if MA fast < MA slow
➡️ Disable MA filtering if you want a pure “structure + SFP” scanner.
---
## 5) Structure filter (optional, 4 checkboxes)
🧱 Filters SFPs based on the direction of recent pivot structure.
⚙️ **Structure count (N)**
- Number of recent pivots used to decide if structure is rising/falling.
- Same N for supports and resistances.
✅ **4 checkboxes (restrictions)**
- **Bullish SFP allowed only if:**
1) ✅ Supports are rising (higher supports)
2) ✅ Resistances are rising (higher resistances)
- **Bearish SFP allowed only if:**
3) ✅ Resistances are falling (lower resistances)
4) ✅ Supports are falling (lower supports)
📌 **Important**
- **No checkbox selected → no structure filter** (all SFPs allowed).
- Selected checkboxes become **mandatory** for the related direction.
---
## 6) Signals & alerts (TradingView)
📍 The script plots “SFP” markers on the chart.
🔔 **3 available alertconditions**
1) **Bullish SFP**
2) **Bearish SFP**
3) ✅ **SFP (Bullish or Bearish)** (combined)
➡️ Use the combined one to save alert slots (one alert for both long + short).
---
## 7) Notes / limitations
- Pivots are confirmed after **Right bars** (expected behavior).
- Some symbols with limited intraday history may produce fewer signals.
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。