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 /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
- uses with optional filter
- show/hide SFP/ SCP candles, , , last min/max bands
- dim lag zones/hide false signals introduced by lagging fractals or
- use unconfirmed to eliminate lag/false signals. 2 modes: fractals 1,1 and highest/lowest
- filter only SFP/ SCP candles confirmed with /candle size
- SFP/ SCP candles color highlighting, dim non-important bars
- adjust settings to get that best match your data (lower values => more frequent . 0,0 - each candle is a )
- use one of the unconfirmed modes to eliminate false signals or just ignore all signals in the gray lag zones
- optionally filter only SFP/ SCP candles with large /candle size ( % 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 /unconfirmed , min/max bands to see which prev 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
- SFP/ SCP candles depend on , you will get different signals with different settings. Usually 4,4 or 2,2 settings are used to produce , but you can try custom values that fit your data best.
- are a mixed series of highs and lows in no particular order. must be filtered to produce a proper where ideally a high is followed by a low and another high in orderly fashion.
- only past can be processed on the current bar introducing a lag, therefore, and min/max bands are shown with offset=-rightBars to match their target bars. For unconfirmed an offset=-1 is used with a lag of just 1 bar.
- new is not a confirmed and "does not exist yet" while the distance between it and the current bar is < rightBars => prev old 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 will be eventually confirmed, but meanwhile you get a false signal because prev 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 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)
- 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 . Both produce more frequent (weaker signals).
- an unconfirmed 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 of a higher degree are not affected. is not affected.
- you can also manually disable the offset to check on which bar the was confirmed. If the just before an SCP /SFP suddenly jumps ahead of it - prev 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( min_low, upivot min_low) and max( max_high, upivot max_high) are used
- in the unconfirmed mode the max high/min low bands partially break because you can't have a variable offset to match the random pos of an unconfirmed (anywhere in 0..rightBars from the current bar) to its target bar.
- in the unconfirmed mode h (green) and l (red) become H and L, and h (lime) and l (fuchsia) are used to show unconfirmed of a smaller degree. Some of them will be confirmed later as H and L of a higher degree.
- filter is used to produce a better looking . 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 of the current swing because they were already confirmed as 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 in the same dir, producing a crude looking where obvious max high/min lows are ignored.
- filter affects SCP /SFP signals because it skips some
- filter is not applied to/not affected by the unconfirmed
- is affected by filter, but not by the unconfirmed . You can't have both high/low on the same bar in a . High has priority over Low.
- keep same bar option lets you choose which to keep when there are both high/low on the same bar (both kept by default)
SCP /SFP Filters:
- you can confirm/filter only SCP /SFP signals with % change/candle size larger than delta. Higher /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 ).
Good Luck! Feel free to learn from/reuse the code to build your own indicators!
- 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
thanks, glad if it helps. I will, perhaps, consider an MTF version at some point. Meanwhile you can attach 2 instances of indicator with different fractal settings - one for current and another for higher tf
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
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