Auto Pitchfork, Fibonacci Retracement & Camarilla Pivots   


The full structural toolkit - trend channels, retracements, and pivot levels in one script.

The Pitchfork is one of the most powerful and most underused tools in technical analysis. Where most indicators react to price, the Pitchfork projects a framework around it - defining the channel within which a trend is likely to continue, the median line it tends to gravitate toward, and the parallel boundaries where it is likely to stall, reverse, or accelerate. Used correctly, it turns a trending chart from a series of unpredictable moves into a structured environment with defined zones of interest.

The challenge has always been anchor placement. Drawing a Pitchfork manually requires selecting three precise pivot points - get them wrong and the entire framework is misaligned. This script removes that dependency entirely, detecting pivots automatically and constructing the Pitchfork in real time as the market structure evolves.


Automatic Swing Detection

Both pitchforks share independent automatic pivot detection engines, each with its own ATR-based deviation and bar depth settings. This allows two Pitchforks at different structural scales to operate simultaneously on the same chart - one anchored to major swings, one to minor - without interference. When a new pivot is confirmed at either scale, the corresponding Pitchfork updates immediately.


Four Pitchfork Types

Each of the two Pitchforks independently supports four construction methods, each suited to different market conditions:

Original (Andrews' Pitchfork) anchors the median line from the first pivot to the midpoint of the second and third pivots. It works best in strongly trending markets where price tends to revert to the median and use the parallel lines as boundaries.

Schiff Pitchfork shifts the median line start point vertically to the midpoint between the first and second pivots, while keeping the end anchor at the midpoint of the second and third. It adapts better to correcting or sideways conditions where the original Pitchfork's slope is too steep.

Modified Schiff Pitchfork shifts the median line start point both horizontally and vertically - to the midpoint between the first and second pivots in both dimensions. The result is almost identical to a parallel channel, making it the most conservative of the four types.

Inside Pitchfork constructs the median line from the midpoint of the second and third pivots, projecting forward using the slope derived from the broader three-point structure. This variant captures internal trend dynamics and is particularly useful when the outer pivot range is wide.


Pitchfork Levels

Each Pitchfork draws parallel channel lines at Fibonacci-inspired distance multiples from the median - 0, 0.25, 0.382, 0.5, 0.618, 0.75, 1.0, 1.5, 1.75, and 2.0 - with lines drawn symmetrically above and below the median. Each level pair represents a potential resistance zone above the median and a support zone below. Background fills between adjacent level pairs provide immediate visual context for which zone price is currently trading within. All levels are independently configurable for colour, width, and line style.

Two Pitchforks with independent settings, independent deviation and depth parameters, and independent level sets can be displayed simultaneously - allowing multi-scale structural analysis within a single script.


Fibonacci Retracements and Extensions

The same three-point swing structure that anchors the first Pitchfork also drives an optional Fibonacci Retracement or Extension overlay. Retracement mode measures pullback levels between the most recent two pivots. Extension mode projects continuation targets beyond the current swing using the prior move as the reference range.

All standard Fibonacci levels from 0 to 4.618, and negative levels down to -0.618, are individually configurable. Label display, placement, line extension, and reverse mode are all independently controlled.


Camarilla Pivot Points

An integrated Camarilla Pivot Points system provides higher-timeframe structural reference levels alongside the Pitchfork and Fibonacci tools. Camarilla pivots use a distinctive calculation methodology - applying fixed multipliers of the prior period's range to the closing price - producing S3, S4, S5, S6 support levels and R3, R4, R5, R6 resistance levels.

The Camarilla calculation emphasises mean reversion at the inner levels (S3/R3) and trend breakout potential at the outer levels (S4/R4 and beyond). An auto-mode timeframe selection matches pivot periods to the current chart timeframe automatically. A configurable trading week start day accommodates markets with non-standard session structures. Historical pivot display is available for context.


ZigZag Structure Overlays

Two independent ZigZag overlays - one for each Pitchfork's pivot set - can be enabled simultaneously, connecting confirmed swing pivots with straight lines to make the structural anchor points visible. Each ZigZag has independently configurable colour, width, and line style.


Alerts

Alerts fire when price crosses the median line of either Pitchfork, any support or resistance level of either Pitchfork, any Fibonacci level, or any Camarilla pivot level - all including the ticker, level name, and current price.


Pitchfork type, deviation, depth, level set, background transparency, label format, line extension, and historical period are independently configurable for each of the two Pitchforks. Fibonacci tool selection, level set, and Camarilla pivot timeframe and label settings are all independently controlled.