RagingRocketBull

Kawabunga Swing Failure Points Candles (SFP) by RRB

Kawabunga Swing Failure Points Candles (SFP) by RagingRocketBull 2019
Version 1.0

This indicator shows Swing Failure Points (SFP) and Swing Confirmation Points ( SCP ) as candles on a chart.
SFP/SCP candles are used by traders as signals for trend confirmation/possible reversal.
The signal is stronger on a higher volume/larger candle size.

A Swing Failure Point (SFP) candle is used to spot a reversal:
- up trend SFP is a failure to close above prev high after making a new higher high => implies reversal down
- down trend SFP is a failure to close below prev low after making a new lower low => implies reversal up

A Swing Confirmation Point ( SCP ) candle is just the opposite and is used to confirm the current trend:
- up trend SCP is a successful close above prev high after making a new higher high => confirms the trend and implies continuation up
- down trend SCP is a successful close below prev low after making a new lower low => confirms the trend and implies continuation down

Features:
- uses fractal pivots with optional filter
- show/hide SFP/SCP candles, pivots , zigzag , last min/max pivot bands
- dim lag zones/hide false signals introduced by lagging fractals or
- use unconfirmed pivots to eliminate fractal lag/false signals. 2 modes: fractals 1,1 and highest/lowest
- filter only SFP/SCP candles confirmed with volume/candle size
- SFP/SCP candles color highlighting, dim non-important bars

Usage:
- adjust fractal settings to get pivots that best match your data (lower values => more frequent pivots . 0,0 - each candle is a pivot )
- use one of the unconfirmed pivot modes to eliminate false signals or just ignore all signals in the gray lag zones
- optionally filter only SFP/SCP candles with large volume/candle size ( volume % change relative to prev bar, abs candle body size value)
- up/down trend SCP (lime/fuchsia) => continuation up/down; up/down trend SFP (orange/aqua) => possible reversal down/up. lime/aqua => up; fuchsia/orange => down.
- when in doubt use show/hide pivots/unconfirmed pivots , min/max pivot bands to see which prev pivot and min/max value were used in comparisons to generate a signal on the following candle.
- disable offset to check on which bar the signal was generated

Notes:

Fractal Pivots:
- SFP/SCP candles depend on fractal pivots , you will get different signals with different pivot settings. Usually 4,4 or 2,2 settings are used to produce fractal pivots , but you can try custom values that fit your data best.
- fractal pivots are a mixed series of highs and lows in no particular order. Pivots must be filtered to produce a proper zigzag where ideally a high is followed by a low and another high in orderly fashion.

Fractal Lag/False Signals:
- only past fractal pivots can be processed on the current bar introducing a lag, therefore, pivots and min/max pivot bands are shown with offset=-rightBars to match their target bars. For unconfirmed pivots an offset=-1 is used with a lag of just 1 bar.
- new pivot is not a confirmed fractal and "does not exist yet" while the distance between it and the current bar is < rightBars => prev old fractal pivot in the same dir is used for comparisons => gives a false signal for that dir
- to show false signals enable lag zones. SFP/SCP candles in lag zones are false. New pivots will be eventually confirmed, but meanwhile you get a false signal because prev pivot in the same dir was used instead.
- to solve this problem you can either temporary hide false signals or completely eliminate them by using unconfirmed pivots of a smaller degree/lag.
- hiding false signals only works for history and should be used only temporary (left disabled). In realtime/replay mode it disables all signals altogether due to TradingView's bug (barcolor doesn't support negative offsets)

Unconfirmed Pivots:
- you have 2 methods to check for unconfirmed pivots: highest/lowest(rightBars) or fractals(1,1) with a min possible step. The first is essentially fractals(0,0) where each candle is a pivot . Both produce more frequent pivots (weaker signals).
- an unconfirmed pivot is used in comparisons to generate a valid signal only when it is a higher high (> max high) or a lower low (< min low) in the dir of a trend. Confirmed pivots of a higher degree are not affected. Zigzag is not affected.
- you can also manually disable the offset to check on which bar the pivot was confirmed. If the pivot just before an SCP/SFP suddenly jumps ahead of it - prev pivot was used, generating a false signal.
- last max high/min low bands can be used to check which value was used in candle comparison to generate a signal: min( pivot min_low, upivot min_low) and max( pivot max_high, upivot max_high) are used
- in the unconfirmed pivots mode the max high/min low pivot bands partially break because you can't have a variable offset to match the random pos of an unconfirmed pivot (anywhere in 0..rightBars from the current bar) to its target bar.
- in the unconfirmed pivots mode h (green) and l (red) pivots become H and L, and h (lime) and l (fuchsia) are used to show unconfirmed pivots of a smaller degree. Some of them will be confirmed later as H and L pivots of a higher degree.

Pivot Filter:
- pivot filter is used to produce a better looking zigzag . Essentially it keeps only higher highs/lower lows in the trend direction until it changes, skipping:
- after a new high: all subsequent lower highs until a new low
- after a new low: all subsequent higher lows until a new high
- you can't filter out all prev highs/lows to keep just the last min/max pivots of the current swing because they were already confirmed as pivots and you can't delete/change history
- alternatively you could just pick the first high following a low and the first low following a high in a sequence and ignore the rest of the pivots in the same dir, producing a crude looking zigzag where obvious max high/min lows are ignored.
- pivot filter affects SCP/SFP signals because it skips some pivots
- pivot filter is not applied to/not affected by the unconfirmed pivots
- zigzag is affected by pivot filter, but not by the unconfirmed pivots . You can't have both high/low on the same bar in a zigzag . High has priority over Low.
- keep same bar pivots option lets you choose which pivots to keep when there are both high/low pivots on the same bar (both kept by default)

SCP/SFP Filters:
- you can confirm/filter only SCP/SFP signals with volume % change/candle size larger than delta. Higher volume/larger candle means stronger signal.
- technically SCP/SFP is always the first matching candle, but it can be invalidated by the following signal in the opposite dir which in turn can be negated by the next signal.
- show first matching SCP/SFP = true - shows only the first signal candle (and any invalidations that follow) and hides further duplicate signals in the same dir, does not highlight the trend.
- show first matching SCP/SFP = false - produces a sequence of candles with duplicate signals, highlights the whole trend until its dir changes (new pivot ).


Good Luck! Feel free to learn from/reuse the code to build your own indicators!
Sürüm Notları: Changes in ver 2.0:
- fixed fractals 0,0 mode (each candle is a pivot) and highest zero error when rightBars = 0.
to treat each candle as a pivot use fractals 0,0. When rightBars = 0 unconfirmed pivots don't matter, however all upivots are still calculated and can be displayed if needed
Extreme fractal modes work as follows:
fractals 1,1 + upivots fractals mode => same result as fractals 1,1 with upivots disabled
fractals 1,1 + upivots highest/lowest mode => fractals 1,1 + each candle is a upivot, slightly different result, new upivots generate signals using prev candle as a pivot instead of the last confirmed fractal 1,1 pivot
fractals 0,0 + upivots highest/lowest mode => each candle is a pivot, same result as fractals 0,0 with upivots disabled
fractals 0,0 + upivots fractals mode => each candle is a pivot, same result as fractals 0,0 with upivots disabled
- fixed volume arrows overlapping H/L pivots in unconfirmed pivots mode for above/below bar char pos (can be set in Style)
- more subtle colors of volume chars/arrows
Favori Komutlardan Çıkart Favori Komutlara Ekle
very well written. thankyou very much for sharing. internet is a great place.
Cevap Gönder
RagingRocketBull Lancelot_Augur
@Lancelot_Augur, you're welcome. I created this so that people could have a better understanding of some of the basic trading concepts such as an SFP without having to write their own indicator first.
Cevap Gönder
Thanks, this is really well done!
I was wondering if you can help me to add alerts for confirmed SFP up and down candles. I tried to add it to the code but cannot seem to get it right.
Hope you can help..
Cevap Gönder
@nickkoers,

Hi, at the moment I'm working on Auto Fibs and Auto S/R Levels, and don't have any plans to add alerts to my existing indicators.
I'm also limited on time because I also have a life to live and other things to do.

But, you can check out one of my Zindarra Multi Alerts indicators and perhaps build your own custom version of SFP with alerts for now.
You are free to reuse/integrate my code in your own indicators in any way you want.

You should probably use
alertcondition(alert_cond...)
where alert_cond = sfp_down_cond and bar_offset is fractal lag but it needs lots of testing
alert_cond should include the confirmed_cond if you want to confirm sfp with volume and candle size
Cevap Gönder
nickkoers RagingRocketBull
@RagingRocketBull,

Thanks for the swift reply, will definitly try this!
Cevap Gönder
@nickkoers,
sfp_down_cond{bar_offset} - bar_offset should be used as a cond index - replace {} with square brackets - the parser filters them out
Cevap Gönder
Incredible work brother. That is a lot of really good clean script. Thank you.
Cevap Gönder
each candle is a pivot extreme mode (fractals 0,0)


with upivots enabled
Cevap Gönder
dimmed bars disabled


first matching candles disabled
Cevap Gönder
confirmed/unconfirmed pivots with last min/max pivot bands


unfiltered zigzag, volume chars above/below bars


zigzag with pivots filter. You don't need zigzag to generate signals
Cevap Gönder
Ana Sayfa Hisse Senedi Takipçisi Forex Takipçisi Kripto Takipçisi Ekonomik Takvim Nasıl Çalışır Grafik Özellikleri Ücretlendirme Kurallarımız Moderatörler Web Sitesi & Aracı Kurum Çözümleri Görsel Bileşenler(Widget) Grafik Çözümleri Destek Merkezi Yeni Özellik Talebi Blog ve Haberler SSS Viki Twitter
Profil Profil Ayarları Hesap ve Ödemeler TradingView Koinleri Destek Kayıtlarım Destek Merkezi Yayınlanmış Fikirler Takip Edenler Takip Ediliyor Özel Mesajlar Sohbet Çıkış