Loading…

Wedge And Triangle Detector

A wedge or triangle is defined by the relationship between two trendlines, not by either one alone. This indicator fits the upper line through the two most recent confirmed swing highs and the lower line through the two most recent confirmed swing lows, converts both slopes to price-change-per-bar so the comparison means the same thing on any timeframe or instrument, and classifies the pair against a small, explicit rule set: one line flat with the other angled is a triangle, both angled the same direction with one steeper is a wedge, both angled toward each other is a symmetrical triangle. The check that matters most is the one many naive versions skip: whether the two lines are actually converging. Two lines that both happen to slope upward are not automatically a rising wedge if the lower line is rising faster than the upper - that pair is diverging, not narrowing, and calling it a wedge would be wrong. This indicator computes exactly where (in bars ahead) the two lines would meet and rejects the classification entirely if they do not converge within a reasonable distance, so only shapes that are actually narrowing toward an apex get named. Both lines and the classification label are recalculated only when a new swing confirms, matching the update rhythm of AutoChannel elsewhere in this catalogue. This is a structural read, not a trade signal - there is no buy or sell arrow here, only a picture of the current converging shape and its name, which necessarily updates as new swing information replaces old. Notes and limitations - Uses only the two most recent swing highs and two most recent swing lows on each side - it is not a best-fit regression through more points, which keeps the geometry simple and matches how a chart reader eyeballs a wedge with a ruler. - The apex projection is exactly that - a projection. Price frequently breaks out of a converging shape well before the lines would have met, which is normal and not a fault of the indicator. - No breakout signal is generated; this indicator identifies and names the shape only. Pair it with a breakout or momentum tool for an actual trigger. - A shape can disappear from one bar to the next if a fresh swing changes which two points define a line - this is a live structural read, not a fixed pattern once drawn.

Indicator · MT4 · v1.0 · Free

About Wedge And Triangle Detector

Wedge And Triangle Detector is an indicator for MetaTrader 4 based on ATR. It can alert you with a pop-up, sound, email or push message. It has 9 settings, such as Swing bars, Atr period and Flat slope atr. MQL source code included.

Files in the download: WedgeTriangle.ex4, WedgeTriangle.mq4, WedgeTriangle.txt.

Settings

SettingDefaultWhat it does
Swing bars5Bars each side required to confirm a swing
Atr period14ATR period used to judge "flat" and convergence
Flat slope atr0.05Slope below this (ATR per bar) counts as flat
Max apex bars500Reject a shape whose lines would only meet beyond this many bars ahead
Extend bars40Bars each line is extended past its newest anchor
Upper colorclrCrimsonUpper (resistance) line colour
Lower colorclrDodgerBlueLower (support) line colour
Line width2Line width
AlertstrueAlert once when the classification changes on a closed bar

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Trend · Alerts · ATR · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria