OPEN-SOURCE SCRIPT

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!
เอกสารเผยแพร่
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
Candlestick Analysisfailed_swingfailurepatternPivot PointsreversalreversalpointsfpswinghighswinglowswingtradingZig Zag Indicator

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ