Andrews Pitchfork Auto Drawer
An Andrews Pitchfork needs three points and, drawn by hand, most of the work is picking them consistently. This indicator automates that part: it scans back through confirmed fractal-style swing points (a high or low that is the most extreme within InpSwingBars bars on both sides), collapses consecutive same-type swings down to the more extreme one so the result strictly alternates high-low-high or low-high-low, and takes the three most recent alternating points as the pitchfork's anchors. The median line runs from the earliest of the three through the midpoint of the other two; two parallel tine lines run through each of those two points, both offset from the median's true direction so all three lines stay genuinely parallel. Switching on the Schiff variant does not just relabel anything - it moves the median line's own starting anchor to the midpoint of the first two pivots instead of the first pivot itself, which is the actual mechanical difference between a standard pitchfork and Schiff's modification. The tines stay anchored the normal way in both modes, since Schiff's modification only ever concerned the median line. Because a pivot cannot be trusted until InpSwingBars bars have confirmed it on both sides, the drawn pitchfork always lags the current bar by that much - the same trade-off every fractal-based auto-drawing tool makes, and the honest price of not repainting a structure that is still forming. Notes and limitations - A pivot only counts once InpSwingBars bars have confirmed it on both sides, so the drawn pitchfork is always at least that many bars behind the current bar - by design, to avoid repainting a structure still in motion. - If fewer than three alternating pivots exist within InpLookbackBars, no pitchfork is drawn; raise InpLookbackBars or wait for more history. - The tie case where one bar qualifies as both a swing high and a swing low (a very tight range) is skipped rather than arbitrarily assigned a type, since it carries no directional information either way. - Redraws only on the close of a bar that actually changes the three-pivot set, not on every tick, so intrabar chart activity never moves the lines.
Indicator · MT4 · v1.0 · Free
About Andrews Pitchfork Auto Drawer
Andrews Pitchfork Auto Drawer is an indicator for MetaTrader 4. It has 7 settings, such as Swing bars, Lookback bars and Schiff. MQL source code included.
Files in the download: AndrewsPitchforkAuto.ex4, AndrewsPitchforkAuto.mq4, AndrewsPitchforkAuto.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Swing bars | 5 | Bars required on each side to confirm a swing pivot |
| Lookback bars | 500 | How far back to search for the three pivots |
| Schiff | false | Use the Schiff variant (median from midpoint of pivots 1-2) |
| Median color | clrDodgerBlue | Median line colour |
| Tine color | clrSilver | Tine (parallel) line colour |
| Line width | 1 | Line width |
| Extend bars | 80 | Bars to extend each line to the right |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Fractals · MT4 Indicator · MQL4 Source Code