HeWhoMustNotBeNamed

Multi ZigZag Harmonic Patterns

Combining Multizigzag with harmonic patterns - this script generates harmonic patterns based on multiple deapth zigzags.

Input parameter allows to chose which Zigzag to be included in pattern identification and set different length, line color, width and style for each Zigzag combinations.

Pattern rules are as below:

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

Related scripts are present here:

Informacje o Wersji: Add max_bars_back
Informacje o Wersji: Added alert condition
Informacje o Wersji: Fixed minor calculation error with respect to zigzag
Informacje o Wersji: Added ABCD patterns and Double Top/Bottom patterns to this script. With multiple zigzags running, display can become messy. Disable the ones you don't use in your input parameters.
Informacje o Wersji: Fix zigzag logical error
Informacje o Wersji:
  • Removed not so important line width and line style parameters.
  • Set all width to 1 and style to solid.
  • Changed colors to suit dark theme :)
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go dodać do ulubionych, żeby używać go na wykresie.

Chcesz użyć tego skryptu na wykresie?
Please PM me if you need access to any invite only scripts.

Join tradingview: https://www.tradingview.com/gopro/?share_your_love=sudh

Komentarze

350 monet
+5 Odpowiedz
Hi, I really love this code.
I saw many potential of this code using array, there are more code can be converted into array.
Keep up the goo
500 monet
+4 Odpowiedz
HeWhoMustNotBeNamed RozaniGhani-RG
@RozaniGhani-RG, thanks very much for your support. Yeah I agree how powerful arrays are. What I am missing though is array of independent structure. If pine can provide that it will make things much simpler.
Odpowiedz
OnlyLogicNoEmotions HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, I really love your code, thanks so much! Really wonderful! Btw, what is an "array of independent structure", do you have an example in another language to understand what Pine Script doesn't currently support?
Odpowiedz
HeWhoMustNotBeNamed OnlyLogicNoEmotions
@OnlyLogicNoEmotions, Structure is group of elements which you can probably see in many programming languages. For example, If we consider Harmonic Pattern as one Object, we should be able to define it something like this:

HarmonicPattern{

float X;
float A;
float B;
float C;
float D;

int xBar;
int aBar;
int bBar;
int cBar;
int dBar;

line XA;
line AB;
line BC;
line CD;

float xabRatio;
float abcRatio;
float bcdRatio;
float xadRatio;

label patternLabel;

}

If we can create data structure like this,
Every time we detect a pattern, we can create this object and push into an array as whole.

Makes implementation much easier. At this point, I have been using different arrays for each of the items within
+3 Odpowiedz
OnlyLogicNoEmotions HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, Ok I see so you need C like struct functionality. Do you have an idea why they don't add it? Struct are significantly less heavy than full Object/Class plus they could place limits on them. You only need very small structs anyways and it would clean up your code quite lot. Do think it is a computation/memory thing or another reason?

Also, random question what do you think is more computationally heavy allowing struct or multi-dimensional arrays?
Odpowiedz
HeWhoMustNotBeNamed OnlyLogicNoEmotions
@OnlyLogicNoEmotions, Yeah. I am more of object oriented programmer. But, I do love the liberty of interpreted scripts. Not sure of complexity involved. We are waiting for pine version 5 release. Expect huge improvements soon.
+1 Odpowiedz
Thanks for the great work!
100 monet
+1 Odpowiedz
Thanks a lot.
200 monet
+1 Odpowiedz
HeWhoMustNotBeNamed Andreas_Resch
@Andreas_Resch, Thanks for your support :)
+1 Odpowiedz