Symmetrical Triangle Detector
- 지표
-
Augusto Martin D'anna
MQL5 & Pine Script developer | Trader since 2019 | Strategy validation
As a trader, I know a bot is only as good as the logic behind it. I bridge
trading concepts and clean code: I don't just follow instructions, I make
sure your EA behaves exactly the way your strategy intends. - 버전: 1.0
Symmetrical Triangle Detector finds horizontal symmetrical triangles with objective rules and draws them up to the apex. Most traders draw triangles by eye; this indicator uses fixed, measurable criteria, so the same chart always gives the same triangles. It uses closed bars only and does not repaint.
What counts as a triangle
- Pivots with N bars on each side, joined in an alternating zigzag.
- The last 4 to 8 pivots: the upper line joins the first and last high, the lower line the first and last low, and the other pivots stay inside.
- At least 3 touches on one line and 2 on the other.
- Symmetric: the upper line falls, the lower line rises, and the steeper slope is at most 4 times the flatter one.
- Horizontal and compact: the middle axis barely moves, the lines are not too steep and the pattern is not too tall.
- Clean: no wick or candle body breaks the lines between the first and the last touch, and enough candles reach the lines (no empty space).
- The apex is ahead of the last touch and not too far away.
All thresholds are measured in ATR(14), so the indicator adapts to any market and timeframe.
What it draws
- Both lines from the first touch to the apex, with the touches numbered.
- An arrow at the breakout (the first wick out of the lines, or a close outside the lines from the 0.75 time mark on), or the pattern ends at the apex.
- Optional Gann box from the first touch to the apex: price levels 0 / 0.5 / 1 and time lines at 0.75 and 0.9.
- Optional alerts when a new triangle appears and when it breaks.
Notes
- This is a pattern detection tool, not a trading signal. In my own tests, trading the breakout or the false breakout of these triangles had no edge after costs on gold, Nasdaq and Bitcoin, so use it as context for your own analysis.
- Defaults were calibrated on BTCUSD M5 and XAUUSD M15. On other markets you may want to adjust the touch tolerance, minimum width and maximum height.
- It is a port of my open-source "Horizontal Symmetrical Triangle Detector" for TradingView, with the same detection rules.
