MTF Fractal Indicator From Existing Code [Super Easy 15 Minute Job]

Job ID: 37888534

Budget: $12 – $30 SGD

Step 1: Modifying existing fractal indicator to account for EQUAL highs and lows

An up fractal occurs when there is a low point with one HIGHER or EQUAL low candles on each side of it.

A down fractal occurs when there is a high point with one LOWER or EQUAL low candles on each side of it.

The reason for the need to create the simple fractal indicator from scratch is because the default fractals indicator doesn’t account for candles besides with EQUAL highs and lows.

As you can see in the above example, there should be a fractal where I placed the red arrow based on our custom fractal indicator, because the candle in front has the same high.

In the event of a case of equal highs, I want the fractal to be drawn on the first candle instead of the next one or third one (in rare cases).

2. Display fractals in another timeframe on the current timeframe.

For 1m timeframe display fractals on the 5m timeframe
For 5m timeframe display fractals on the 15m timeframe
For 15m timeframe display fractals on the 1h timeframe
For 1h timeframe display fractals on the 4h timeframe
For 4h timeframe display fractals on the D timeframe
For D timeframe display fractals on the W timeframe
For W timeframe display fractals on the M timeframe
For M timeframe display fractals on the 3M timeframe
For 3M timeframe display fractals on the 12M timeframe

Existing code for basic fractal indicator

//@version=3
study("Fractals - Custom Periods", overlay=true)
fractalPeriods = input(title="Fractal Periods", defval=2, minval=1, type=integer)
bullFractal = pivothigh(fractalPeriods, fractalPeriods)
bearFractal = pivotlow(fractalPeriods, fractalPeriods)
plotchar(bullFractal?true:na, title="Bull Fractal", location=location.abovebar, offset=-fractalPeriods, color=black, transp=0, size=size.tiny, char='▴')
plotchar(bearFractal?true:na, title="Bear Fractal", location=location.belowbar, offset=-fractalPeriods, color=black, transp=0, size=size.tiny, char="▾")
Related categories: Pine Script Trading