TradingView
Trendoscope
Jul 21, 2021 1:15 PM

Auto Harmonic Patterns - Open Source 

HUB24 LIMITEDASX

Description

I may not be able to spend much time on the harmonic patterns and realized that there are not much open source scripts on them either. Hence, decided to release open source version which can be used by other developers for reference and build things on top of it.

Original script is protected and can be found here:
tradingview.com/script/PCOw0dtT-Auto-Harmonic-Patterns/

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


This script contains everything which original script has apart from stats. Use the original script if you are not developer looking for code reference and prefer having stats table.

I have also developed a strategy based on harmonic patterns which can be found here:
tradingview.com/script/KXvS2o0o-Auto-Harmonic-Patterns-Long-only-Strategy/

Release Notes

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

Release Notes

Update labels

Release Notes

update labels

Release Notes

Fix error

Release Notes

Remove stats again

Release Notes

Corrected errors in 3-Drive and 5-0 where B does not need to be in the middle.

Release Notes

Minor parameter adjustments.

Release Notes

Add labels.

Release Notes

Minor correction in zigzag calculation logic.

Also, check my other script on harmonic pattern (Again - open source)
tradingview.com/script/Q7YifAAf-Multi-ZigZag-Harmonic-Patterns/

Release Notes

No updates. But, just converted to pine 5 :)
Comments
Ankit_1618
Good Work
Trendoscope
@Ankit_1618, Thanks very much :) There are few other harmonic pattern variations I have published after this. Have a look. Also have a look at Auto Harmonic Patterns - V2 - which is protected script. But, you will still be able to use it.
memememira
Trendoscope
@memememira, Thanks very much mate :)
imohitahuja21
I appreciate your work bro but the pattern are not being formed on time, it forms after the stock reaches 1st or 2nd target? why is it slow? is it the same for everyone?
Trendoscope
@imohitahuja21, that’s because patterns are calculated once zigzag pivot is confirmed. Which may take few bars based on the movement. This is done to avoid false signals.

I have created another script : tradingview.com/script/Q7YifAAf-Multi-ZigZag-Harmonic-Patterns/

Here too default setting is to use confirmed zigzag. But, you can turn it off with setting WaitForConfirmation.
imohitahuja21
@HeWhoMustNotBeNamed, thanks I will check this one for sure. keep up the good work bro. :)
BankiFX
@HeWhoMustNotBeNamed, can we turn it off in this script ?
banedmedia
@HeWhoMustNotBeNamed, how can you turn it off bro? I can't find the option
DannyThan
More