TradingView
Trendoscope
Jul 9, 2021 1:08 PM

Auto Harmonic Patterns 

Apple Inc.NASDAQ

Description

This is my first attempt on plotting harmonic patterns based on zigzag. Initial version is still primitive and might need lot of time to mature into more formidable one. Will try to explain entire logic in the description. Please feel free to correct me if my understanding of any pattern and underlying logic is incorrect.

In the initial version,

  • Only immediate high lows of pivots are considered for calculation of patterns.
  • In case of ABCD Types, only one is shown at a time. Hence, disabling certain ABCD pattern types may result in different numbers.
  • Logic for double top/bottom is taken from previous script - Double top/bottom Ultimate. Though logic of confirmation and invalidation is not included
  • All other patterns which involve 4+ lines can coexist and often shown together.
  • Smaller timeframes may give error due to some pine limitations.
  • Error percent parameter is used for allowing minor deviation from the standard ratios.



Logical ratios of patterns are coded as below:

Notations:
  • Lines XABCD forms the pattern in all cases. (OXABCD in case of Three drives)
  • abc = BC retacement of AB, xab = AB retracement of XA and so on


ABCD Classic
  • 0.618 <= abc <= 0.786
  • 1.272 <= bcd <= 1.618


AB=CD
  • Price difference between AB and CD are equal
  • Time difference between AB and CD are equal


ABCD Extension
  • 0.618 <= abc <= 0.786
  • 1.272 <= AD/BC (price) <= 1.618


Gartley
  • xab = 0.618
  • 0.382 <= abc <= 0.886
  • 1.272 <= bcd <= 1.618 OR xad = 0.786


Crab
  • 0.382 <= xab <= 0.618
  • 0.382 <= abc <= 0.886
  • 2.24 <= bcd <= 3.618 OR xad = 1.618


Deep Crab
  • xab = 0.886
  • 0.382 <= abc <= 0.886
  • 2.0 <= bcd <= 3.618 OR xad = 1.618


Bat
  • 0.382 <= xab <= 0.50
  • 0.382 <= abc <= 0.886
  • 1.618 <= bcd <= 2.618 OR xad = 0.886


Butterfly
  • xab = 0.786
  • 0.382 <= abc <= 0.886
  • 1.618 <= bcd <= 2.618 OR 1.272 <= xad <= 2.618


Shark
  • xab = 0.786
  • 1.13 <= abc <= 1.618
  • 1.618 <= bcd <= 2.24 OR 0.886 <= xad <= 1.13


Cypher
  • 0.382 <= xab <= 0.618
  • 1.13 <= abc <= 1.414
  • 1.272 <= bcd <= 2.0 OR xad = 0.786


Three Drives
  • oxa = 0.618
  • 1.27 <= xab <= 1.618
  • abc = 0.618
  • 1.27 <= bcd <= 1.618


5-0
  • 1.13 <= xab <= 1.618
  • 1.618 <= abc <= 2.24
  • bcd = 0.5

Release Notes

  • Removed deviation threshold and disable stats on load. (Can be enabled in settings)
  • Default length is set to 5

Release Notes

Convert to pine 5

Release Notes

Update tags
Comments
Nowifi220
Nice Job !!
Machine425
Hi, great work!
PLS let me know the reason of "Too many drawings, cannot clean oldest."
I have 4 chart on trading view (10m, 15m, 30m, 1 hour).
On 10m , it works very well. but the others show me that massage( Too many drawings, cannot clean oldest.)
Thanks!
Trendoscope
@Machine425, Hey, please try multi zigzag harmonic pattern and multi level zigzag harmonic patterns script.

Number of lines issue is common in lower timeframes for scripts which draws too many lines and labels.
Gergi88
hi Awesome work, have search for serveral scripts like this and yours is the best. Is there a way to make alerts when a pattern is ploted?
Trendoscope
@Gergi88, I have added alerts in the multi zigzag version. tradingview.com/script/Q7YifAAf-Multi-ZigZag-Harmonic-Patterns/

I may not update this script anymore. But, will add alert to open source version of same script published.
SterlingCable
Dope
just_naba
always great done, many thanks,,,, just if u put a total in the end for bullish and bearish it will be more easy for the signal ,,,
Trendoscope
@naba_naif, Thanks. Will do it on next release :)
just_naba
IIIMrNobodyIII
It has big lagging. It draws after 5 or 10 candles.
More