OPEN-SOURCE SCRIPT

Swing Failure Pattern (SFP) [LuxAlgo]

The Swing Failure Pattern indicator highlights Swing Failure Patterns (SFP) on the user chart, a pattern occurring during liquidity generation from significant market participants.

A Confirmation level used to confirm a trend reversal is also included. Users can additionally filter out SFP based on a set Volume % Threshold.

🔶 USAGE

ảnh chụp nhanh

Swing failure patterns occur when candle wicks exceed (above/below) a recent swing level but close back below/above it, and occur from more significant market participants engineering liquidity. This pattern can be indicative of a potential trend reversal.

ảnh chụp nhanh

A label and an accentuated wick line highlight the SFP (both can be disabled).

ảnh chụp nhanh

Using a higher "Swings" period will not return different SFP but will however potentially reduce their detection rate.

🔹 Confirmation Level

The confirmation level is the highest point between the previous swing and SFP for a bullish SFP, and the lowest point for a bearish SFP. This level allows confirming a trend reversal after an SFP once the price breaks it.

ảnh chụp nhanh

A small triangle will be displayed when the price closes beyond the confirmation level.

ảnh chụp nhanh

A more reactive and contrarian approach could use the SFP as an entry point, and the confirmation level for taking (partial) profit, or stop loss. The example below shows a possible scenario:

ảnh chụp nhanh

🔹 Volume % Threshold

During the occurrence of an SFP, the Volume % Threshold option allows comparing the cumulative volume outside the Swing level to the total volume of the candle. The following options are included:

  • Volume outside swing < Threshold: Volume outside the Swing level needs to be lower than x % of total candle volume. Prevent excessive liquidity generation.
  • Volume outside swing > Threshold: Volume outside the Swing level needs to be higher than x % of total candle volume. Requires more significant liquidity to be generated.
  • None: No extra filter is applied


ảnh chụp nhanh

Note that in the above case, the left SFP is no longer highlighted because the volume above the swing level was higher than the 25% threshold of the total volume.

When we change the setting to "Volume outside swing > Threshold", we get the reversed situation.

ảnh chụp nhanh

The "Volume outside Swing level" is obtained using intrabar - Lower TimeFrame (LTF) data.

At the intrabar (LTF) level, there are a maximum of 100K bars available. When using the Volume % Threshold filter, a vertical line will highlight the maximum period during which intrabars are available.

ảnh chụp nhanh

🔶 DETAILS

🔹 LTF Settings

When 'Auto' is enabled (Settings, LTF), the LTF will be the nearest possible x times smaller TF than the current TF. When 'Premium' is disabled, the minimum TF will always be 1 minute to ensure TradingView plans lower than Premium don't get an error.

Examples with current Daily TF (when Premium is enabled):
  • 500 : 3-minute LTF
  • 1500 (default): 1-minute LTF
  • 5000: 30 seconds LTF (1 minute if Premium is disabled)


The concerning LTF can be seen at the right-top (default) corner.

🔶 SETTINGS

  • Swings: Period used for the swing detection, with higher values returning longer-term Swing Levels.
  • Bullish SFP: enable/disable bullish Swing Failure Patterns.
  • Bearish SFP: enable/disable bearish Swing Failure Patterns.


🔹 Volume Validation

Validation:
  • Volume outside swing < Threshold: The volume outside the swing level needs to be lower than x % of the total volume.
  • Volume outside swing > Threshold: The volume outside the swing level needs to be higher than x % of the total volume.
  • None: No extra validation is applied.


Volume % Threshold: % of total volume as threshold.

  • Auto + multiple: Adjusts the initial set LTF
  • LTF: LTF setting
  • Premium: Enable when your TradingView plan is Premium or higher


🔹 Dashboard

  • Show Dashboard: Display applied Lower Timeframe (LTF)
  • Location: Location of the dashboard
  • Size: Size of the dashboard


🔹 Style

  • Swing Lines
  • Confirmation Lines
  • Swing Failure Wick
  • Swing Failure Label
  • Lines / Labels: Color for lines and labels
  • SFP Wicks: Color for SFP wick line
breakoutsignalluxalgoreversalreversalpatternsfpsignalswingfailurepatternswingstrendTrend Analysis

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm