Fractal Pitchfork
Fractal Pitchfork is an indicator drawn over the price chart.
state
1
indicator "Fractal Pitchfork"2
pane: price3
4
state points: list<tuple<int, price>> = []5
6
f = fractals(2)7
8
if f.up:9
points.push((bar.index - 2, high[2]))10
if f.down:11
points.push((bar.index - 2, low[2]))12
points = points.keep_last(3)13
14
if points.len == 3:15
pitchfork points: points16
polygon points: points, fill: blue.fade(90), border: blue17
arrow from: points.get(0), to: points.get(2), color: grayWhat this script says
Fractal Pitchfork is an indicator drawn over the price chart.
It remembers points from one bar to the next.
It calculates f as the fractals (periods 2) and points as points.keep_last(3).
On each bar, it checks whether f.up and, if so, adds (bar.index - 2, high[2]) to points.
On each bar, it checks whether f.down and, if so, adds (bar.index - 2, low[2]) to points.
On each bar, it checks whether the number of points is 3 and, if so, draws a pitchfork, draws a polygon and draws an arrow.