OPEN-SOURCE SCRIPT

Prometheus Fractal Wave

812
The Fractal Wave is an indicator that uses a fractal analysis to determine where reversals may happen. This is done through a Fractal process, making sure a price point is in a certain set and then getting a Distance metric.

Calculation:
A bullish Fractal is defined by the current bar’s high being less than the last bar’s high, and the last bar’s high being greater than the second to last bar’s high, and the last bar’s high being greater than the third to last bar’s high.

A bearish Fractal is defined by the current low being greater than the last bar’s low, and the last bar’s low being less than the second to last bar’s low, and the last bar’s low being less than the third to last bar’s low.

When there is that bullish or bearish fractal the value we store is either the last bar’s high or low respective to bullish or bearish fractal.

Once we have that value stored we either subtract the last bar’s low from the bullish Fractal value, and subtract the last bar’s high from the bearish Fractal value. Those are our Distances.

Code:

Pine Script®
isBullishFractal() =>
    high[1] > high and high[2] < high[1] and high[1] > high[3]

isBearishFractal() =>
    low[1] < low and low[2] > low[1] and low[1] < low[3]

var float lastBullishFractal = na
var float lastBearishFractal = na

if isBullishFractal() and barstate.isconfirmed
    lastBullishFractal := high[1]

if isBearishFractal() and barstate.isconfirmed
    lastBearishFractal := low[1]

//------------------------------
//-------CACLULATION------------
//------------------------------
bullWaveDistance = na(lastBullishFractal) ? na : lastBullishFractal - low[1]
bearWaveDistance = na(lastBearishFractal) ? na : high[1] - lastBearishFractal


We then plot the bullish distance and the negative bearish distance.

The trade scenarios come from when one breaks the zero line and then goes back above or below. So if the last bullish distance was below 0 and is now above, or if the last negative bearish distance was above 0 and now below. We plot a green label below a candle for a bullish scenario, or a red label above a candle for a bearish one, you can turn them on or off.

Code:

Pine Script®
plot(bullWaveDistance, color=color.green, title="Bull Wave Distance", linewidth=2)
plot(-bearWaveDistance, color=color.red, title="Bear Wave Distance", linewidth=2)
plot(0, "Zero Line", color=color.gray, display = display.pane)

bearish_reversal = plot_labels ? bullWaveDistance[1] < 0 and bullWaveDistance > 0 : na
bullish_reversal = plot_labels ? -bearWaveDistance[1] > 0 and -bearWaveDistance < 0 : na

plotshape(bullish_reversal, location=location.belowbar, color=color.green, style=shape.labelup, title="Bullish Fractal", text="↑", display = display.all - display.status_line, force_overlay = true)
plotshape(bearish_reversal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Bearish Fractal", text="↓", display = display.all - display.status_line, force_overlay = true)


syot kilat

We can see in this daily QQQ chart that the indicator gives us marks that can either be used as Reversal signals or as breathers in the trend.

syot kilat

Since it is designed to provide reversals, on something like Gold where the uptrend has been strong, the signals may be just short breathers, not full blown strong reversal signs.

syot kilat

The indicator works just as well intra day as it does on larger timeframes.

We encourage traders to not follow indicators blindly, none are 100% accurate. Please comment on any desired updates, all criticism is welcome!

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.