Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

lonew0lf

Harmonic Indicator

Recommended Posts

So the folks who use metatrader have had access to a host of indicators, one in particular used for trading harmonics is called ZUP. The persons who created ZUP wrote it in their native language, Russian and i don't believe there ever been a translation I spent the weekend converting it to English as best as I could with the hope that maybe this community could help turn the code into something similar for Multicharts and tradestation users.

ZUP83 english.txt

5aa70fa0273b2_validcrab.thumb.gif.50bacd8c53bf125473962206367286a9.gif

5aa70fa02d02d_tlquestion.thumb.gif.37494dc936731912614d98a215fff84d.gif

5aa70fa0316f4_ey.9.930minsetup.jpg.e7972da75e35e75a303826a622e88cc9.jpg

5aa70fa035cfc_4_23.08GBP.USDretracement.jpg.d7c598834bf1f5e29cc68b08b2a3b9d1.jpg

Edited by lonew0lf

Share this post


Link to post
Share on other sites
Looks like a gartley...or maybe a crab (they all look quite similar to me to be honest). Harmonictrader.com has a bunch of these patterns (as I am sure lonew0lf knows).

 

 

..... ..... it's a waste of precious time

Share this post


Link to post
Share on other sites

Tams - I've got the pasevento indicator, the issue is being able to build off the indicator so it marks out distinct patters such as:

 

ab=cd

gartley

butterflies

etc.

 

The script i posted has the pasevento indicator as a crucial component.

Share this post


Link to post
Share on other sites
Tams - I've got the pasevento indicator, the issue is being able to build off the indicator so it marks out distinct patters such as:

 

ab=cd

gartley

butterflies

etc.

 

The script i posted has the pasevento indicator as a crucial component.

 

 

you have to describe a bit more to get people motivated...

Share this post


Link to post
Share on other sites

Tams - not sure the purpose of your responses... is it to maintain an ongoing banter between you and I? If you're not interested in working on it, that's fine.

 

There isn't more to describe other than looking at the metatrader script the initial charts and beginning the conversation there.

 

If I wanted snark i'd go to elite trader.

Share this post


Link to post
Share on other sites
Tams - not sure the purpose of your responses... is it to maintain an ongoing banter between you and I? If you're not interested in working on it, that's fine.

 

There isn't more to describe other than looking at the metatrader script the initial charts and beginning the conversation there.

 

If I wanted snark i'd go to elite trader.

 

 

LOL... I will put you on ignore... Have a nice day.

Share this post


Link to post
Share on other sites

Suppose someone doesn't like to be challenged. You know there's nothing wrong with saying you can't do something, its another when you can't do it and you try and dismiss it.

 

Tams - you're my hero.

Share this post


Link to post
Share on other sites

derek,

The text file is corrupted so I hesitate to even open the eld in TS and I don’t have time to fix the code myself. It's probably a half assed cleanup of a russian hack...

So... here are some pointers to get you started -

There are multiple strings that are not properly commented scattered throughout this file. First example , f. [* R# _) V9 m8 `) ~ is found in the array: declarations in the var section.

 

Many subsequent ‘strings’ have an opening brace without a closing brace.

Early examples are in Method int BatSetup() on lines

> if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged 3 r$ }% K8 m: |$ {8 F+ J1 r; F

> end; 8 m7 {; k: Z! p5 ~ v# ]

> end; + G, h& m! k8 {' _

 

Options

Either remove all those random strings throughout ...

Those same lines in Method int BatSetup() would read like

> if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged

> end;

> end;

 

Or

 

If they have relevance, then properly comment all those random strings throughout, remembering to remove or close all brackets... which would would mess up the strings though...

Examples in Method int BatSetup() would read like

> if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged {{3 r$ }% K8 m: |$ {8 F+ J1 r; F}}

> end; {8 m7 {; k: Z! p5 ~ v# ]}}

> end; {+ G, h& m! k8 {' _ }}

 

Whichever option you choose, ALL these 'random' strings throughout have to be dealt with before you move on to the other code issues in this file

 

Or

 

See if you can download the original MarsallaMarceau code from TS Forums ?? It's likely still up there and MarsallaMarceau was a good coder...

 

Or

 

Get help on TS Forums

 

Hth

 

zdo

Share this post


Link to post
Share on other sites

Hi

Thank you for your reply

 

As you say the text file was corrupted

I have posted the code below

I hope that this helps

Derek

 

{ Indicator style settings: }
       p4  Right tic 9 
       p5  Bar high 
       p6  Bar low 
       p7  point 
       p8  point 
       p41-p56: line, with checked "Don't automatically connect plot lines 
       p80 bar high 
       p81 bar low 
       p82 bar high 
       p83 bar low 


using elsystem.collections;    
using elsystem;   8 

{ The pattern rules are from 
       Harmonic Trading Vol 1 & 2, Scott Carney ' 
} 

{ 
Revision History: 
       2013-01-10: Initial release (MarsallaMarceau) 
} 
{0 q% G$ V( X% i/ W$ j% }
input: zigfac(2); 

input: ShoBat(true); 
input: ShoButterfly(false); 
input: ShoGartley(false); ) 
input: ShoCrab(false); 
input: ShoDeepCrab(false);  
input: ShoFiveOh(false); 
input: ShoABeCD(false{AB=CD}); 
input: ShoBars(true); 

input: ShoFibLabel(false); 
input: ShoZigZag(true); 
input: ShoZZBands(false);

input: BearishColor(darkred); 
input: BullishColor(darkgreen);    

var: zigback(14 * zigfac); 
array: p[10](0), pb[10](0), patrn[10](0), confrm[10](0); , f. [* R# _) V9 m8 `) ~
const: bat.bullish(1), gartley.bullish(2), crab.bullish(3), deepcrab.bullish(4), butterfly.bullish(5), fiveoh.bullish(6); 
const: bat.bearish(-1), gartley.bearish(-2), crab.bearish(-3), deepcrab.bearish(-4), butterfly.bearish(-5), fiveoh.bearish(-6); 
const: pattern.confirmed(1), pattern.failed(2), pattern.limbo(3); $ b& d5 m% x5 ?( M
var: XX(0), AA(0), BB(0), CC(0), DD(0), EE(0); 9 F6 d. R5 D1 n! u) p4 O
var: XXb(0), AAb(0), BBb(0), CCb(0), DDb(0), EEb(0); 
var: Pattern(0); 8 M- w4 \; h, K# v
var: targI(0), targO(0), targCD(0), bestConfirm(0); 
 i" t6 k7 h& b& m# k- e3 g
///////////////////////////////////////////////////////////////////////////// 
// BAT 
///////////////////////////////////////////////////////////////////////////// 9 D6 J9 N" |; K6 ?- S5 i% ]

Method int BatSetup() 
var: int setup, double near_r; 6 e) [5 O% J2 l2 j6 t" T
begin " F% g8 a; i) ]: G# d0 ?6 v. K
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged 3 r$ }% K8 m: |$ {8 F+ J1 r; F
       setup = 0; 
       near_r = NearestFib(ratio("AB","XA")); 1 ?& [7 y' x: Y
       If near_r >= .382 and near_r <= .5 then begin 
               near_r = NearestFib(ratio("BC","AB")); 
               If near_r >= .382 and near_r <= .886 then begin # g8 L/ H4 T: P% c$ e+ M& W% Y3 l
                       If True then begin  
                               setup = oo_iff(AA>XX,bat.bullish,bat.bearish) astype int; 
                               targI = CC - 1.618 * (CC - BB); 
                               targO = CC - 2.618 * (CC - BB); 
                               bestConfirm = AA - .886 * (AA - XX); 
                               If ShoABeCD then 
                                       targCD = DD-(CC-BB); 
                       end; 
               end; 8 m7 {; k: Z! p5 ~  v# ]
       end; + G, h& m! k8 {' _
       Return setup; 
end; 
Method int BatConfirm() 
var: double near_r; , Z$ ?; @( c4 A4 C; i0 R1 O
begin 
       If Pattern = 0 then return 0; / n. D- p6 _$ G5 Z, z9 g, k! S7 j  d

       near_r = NearestFib(ratio("CD","BC"));  
       If near_r >= 1.618 and near_r <= 2.618 then begin ( S; h! u5 J! g, @5 P
               //print(date:9:0,time:5:0," ...confirmed Bat");                 
               Return pattern.confirmed; 
       End else begin 
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide 0 a) ~2 [& ]0 I9 V
               Switch pattern begin 
               Case bat.bullish: 0 ~1 T: _3 i3 E2 v6 F7 k
                       If CC > AA then return pattern.failed; // might happen after limbo + ]8 o/ n( d/ V) Q& y
                       If DD < targO then return pattern.failed; 
                       Return pattern.limbo; 
               Case bat.bearish: 
                       If CC < AA then return pattern.failed; // might happen after limbo & D% T* E! b3 B3 o% o' B
                       If DD > targO then return pattern.failed; 
                       Return pattern.limbo; ( Q  O0 z: O: t
               end; % d9 {6 [2 n" p$ @( X' O
       end; 9 o$ r4 y3 k9 r* q
       Return 0; . Y3 m, M+ Y9 ]: ^2 ~9 V* |7 g
end; 

///////////////////////////////////////////////////////////////////////////// 
// BUTTERFLY 
///////////////////////////////////////////////////////////////////////////// 6 h0 ^3 J- {* D+ t+ p

Method int ButterflySetup() : U# h# J: A3 |' Z8 O* w* r
var: int setup, double near_r, double targ; 6 X6 p6 S6 x! S8 P, a
begin 
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged 
       setup = 0;  2 u" W  J* m/ O4 S
       near_r = NearestFib(ratio("AB","XA")); + ^  ^/ D4 v, l( P$ U, }
       If near_r = .786 then begin ; @5 L- k% _: H0 L# {% Y8 h' Q
               near_r = NearestFib(ratio("BC","AB")); 1 G. T* \+ y' S7 q
               If near_r >= .382 and near_r <= .886 then begin ) v1 c; \  s1 V) s  v9 |
                       targ = CC - 1.618 * (CC - BB); & X$ x; ^* l& M2 d8 Q, u
                       If absvalue(AA-XX) < absvalue(AA-targ) then begin  1 s  y3 T& ^8 P# T2 B
                               setup = oo_iff(AA>XX,Butterfly.bullish,Butterfly.bearish) astype int; - r) B; d' I+ I* {
                               targI = targ; 
                               targO = CC - 2.24 * (CC - BB); & B- y" `8 d/ W' c3 w) G
                               bestConfirm = AA - 1.27 * (AA - XX); 
                               If ShoABeCD then 9 q" h5 w; z. ~2 }# _, n
                                       targCD = DD-(CC-BB); + C4 p" n+ Q& y# N$ V) y% `: `- F
                       end; 
               end; 
       end; 
       Return setup; 
end; , J* e5 |9 L  u
Method int ButterflyConfirm() 1 L$ V+ d+ u9 k: h6 c8 A# Q/ F
var: double near_r; 
begin 
       If Pattern = 0 then return 0; 
) c5 J) ^; v$ W8 n( A
       near_r = NearestFib(ratio("CD","BC")); ! I2 u/ J- b' k: Y5 @
       If near_r >= 1.618 and near_r <= 2.24 then begin ' l7 K1 y; m3 q
               //print(date:9:0,time:5:0," ...confirmed Butterfly");                 0 t1 c1 F+ a% H2 k
               Return pattern.confirmed; ! Z, a! `! c( a& O3 r
       End else begin 
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide , B4 H/ m" c' o2 p% k
               Switch pattern begin ' _4 m: W$ [: m! u6 H# ]8 v
               Case Butterfly.bullish: 
                       If CC > AA then return pattern.failed; // might happen after limbo 
                       If DD < targO then return pattern.failed; 
                       Return pattern.limbo; 
               Case Butterfly.bearish: 
                       If CC < AA then return pattern.failed; // might happen after limbo 
                       If DD > targO then return pattern.failed;   S4 @4 P7 ]* ~
                       Return pattern.limbo; 
               end; - l0 j  [1 i' ?; z! X6 Q$ E9 m& T
       end; 
       Return 0; 
end; 
& x/ Q3 f; C& e; W$ q2 N' s
///////////////////////////////////////////////////////////////////////////// 
// GARTLEY 1 ^; l( L" j2 o4 u0 w( {
///////////////////////////////////////////////////////////////////////////// 3 t+ {% L4 w7 i- w* z  R, c
 e+ M/ Q% e* K  X+ y" F
Method int GartleySetup() 
var: int setup, double near_r; 
begin / V2 T! ?5 l2 t2 K7 g
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged : G) U; O( E& ^1 Z3 Z
       setup = 0; 9 |+ G+ y. Y; q9 T/ |  b  x
       near_r = NearestFib(ratio("AB","XA")); . O6 M& `+ R1 f. T
       If near_r = .618 then begin - F. K0 h0 `3 o5 u1 N9 f
               near_r = NearestFib(ratio("BC","AB")); 4 m, U( X0 U, |# T9 x
               If near_r >= .382 and near_r <= .886 then begin 
                       If True then begin  
                               //print(date:9:0,time:5:0," gartley setup");                 & C1 P, }0 a) A
                               setup = oo_iff(AA>XX,gartley.bullish,gartley.bearish) astype int; 4 }2 ~7 E8 `5 Q% y& z% m
                               targI = CC - 1.13 * (CC - BB); 
                               targO = CC - 1.618 * (CC - BB); 
                               bestConfirm = AA - .786 * (AA - XX); ! j0 T; S5 }$ B7 m: s7 D9 Y
                               If ShoABeCD then 
                                       targCD = DD-(CC-BB); ( T2 i; g4 Q4 k( F) p+ [  z
                       end; # K$ z( E3 g$ k
               end; 
       end; , s% _; Y1 S/ q7 q, w
       Return setup; 
end; 
Method int GartleyConfirm() 
var: double near_r; 
begin 
       If Pattern = 0 then return 0; 

       near_r = NearestFib(ratio("CD","BC")); 
       If near_r >= 1.13 and near_r <= 1.618 then begin 
               //print(date:9:0,time:5:0," ...confirmed gartley");                 
               Return pattern.confirmed; & O: |/ F! _2 r6 v  \
       End else begin - H( V: w& V$ F" a: Y! V! S) X
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide 
               Switch pattern begin 
               Case gartley.bullish: " K% a+ j  ~# F% d: J' x
                       If CC > AA then return pattern.failed; // might happen after limbo 
                       If DD < targO then return pattern.failed; 
                       Return pattern.limbo; 9 Q2 U# w4 Q% W; y% `
               Case gartley.bearish: , m  Y' e7 {6 s0 P
                       If CC < AA then return pattern.failed; // might happen after limbo ; Y6 k" u) M+ f2 h4 H. I
                       If DD > targO then return pattern.failed; ( e4 _1 ?( Q& ]6 X  h: b" C0 o
                       Return pattern.limbo; ( p: m, j& t$ e" h1 ?4 [
               end; 1 ~9 H( K3 |9 O3 T2 e
       end; 2 c1 ~  Y9 T2 R6 D: N; |
       Return 0; : }3 H$ `1 D, Q/ I9 G
end; 

///////////////////////////////////////////////////////////////////////////// 
// CRAB : g7 b, U3 f6 f4 z* i' E
///////////////////////////////////////////////////////////////////////////// : ~# I) N, C. v3 z" p2 A

Method int CrabSetup() 
var: int setup, double near_r, double targ; + L/ E  }4 u6 {' ^6 {) n& r
begin 0 z2 l) m# r, C& O7 R5 u& y
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged   D( G+ m  y% A3 r, [( Z! C$ z
       setup = 0; " a5 E% `3 w; f% f' i
       near_r = NearestFib(ratio("AB","XA")); 
       If near_r >= .382 and near_r <= .618 then begin 
               near_r = NearestFib(ratio("BC","AB")); 
               If near_r >= .382 and near_r <= .886 then begin " S: r+ N# f' x! c, E2 q4 c6 F$ s( l/ c
                       targ = CC - 2.618 * (CC - BB); 
                       If absvalue(AA-XX) < absvalue(AA-targ) then begin  
                               //print(date:9:0,time:5:0," crab setup");                 - H) ?% ~8 h7 P
                               setup = oo_iff(AA>XX,crab.bullish,crab.bearish) astype int; . j% Y$ ^$ |/ Q0 k# y% P% {
                               targI = targ; //CC - 2.618 * (CC - BB); 7 B7 r. Z: g# S+ k8 x; G' ]
                               targO = CC - 3.618 * (CC - BB); * X# ?% t: y4 j! X% k8 W1 D3 {4 n
                               bestConfirm = AA - 1.618 * (AA - XX); 9 |4 g* Q3 U, ~0 Z" n+ s% G
                               If ShoABeCD then 8 q8 K2 A; j0 g" g
                                       targCD = DD-(CC-BB);   b3 H5 v* H; ~8 |6 D2 P" N. H
                       end; - f$ B) i- Y6 w# C
               end; 7 _2 e, R- d* ^; [( w+ W
       end; 
       Return setup; 
end; 
Method int CrabConfirm() - W" W6 G, ~0 L5 s5 B! v
var: double near_r; 5 l- U* }( }; O% G) z
begin 
       If Pattern = 0 then return 0; 2 l" q: Q7 G* F# d1 X& T
. \+ y6 l9 p6 I" h; W: b9 V
       near_r = NearestFib(ratio("CD","BC")); 
       If near_r >= 2.618 and near_r <= 3.618 then begin 
               //print(date:9:0,time:5:0," ...confirmed crab");                 
               Return pattern.confirmed; 
       End else begin ; V5 g/ w) O, T
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide 
               Switch pattern begin 
               Case crab.bullish: 2 j$ {" W& Z, _9 K8 W
                       If CC > AA then return pattern.failed; // might happen after limbo ! U  m) U1 L6 Q: A, o- b
                       If DD < targO then return pattern.failed; " e/ [2 D. `2 A6 g: j' {8 @
                       Return pattern.limbo; 
               Case crab.bearish: " a1 u$ q$ @5 ~0 I7 f! E- P
                       If CC < AA then return pattern.failed; // might happen after limbo 
                       If DD > targO then return pattern.failed; ' L% a% \$ h) Q2 W
                       Return pattern.limbo; 
               end; 6 }% [2 P& G" I
       end; * I( }  {' E  J3 V5 ]0 n
       Return 0; 
end; 

///////////////////////////////////////////////////////////////////////////// 4 _3 L5 S) i7 [: D
// DEEP CRAB 
///////////////////////////////////////////////////////////////////////////// 

Method int DeepCrabSetup() 9 Z  w* Q" S$ S9 h) q' R
var: int setup, double near_r, double targ; 
begin 
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged 
       setup = 0; 5 @  u, b+ u9 O5 N  U/ ~" ^' J2 O
       near_r = NearestFib(ratio("AB","XA")); 0 C$ {5 b& v  i/ _" w$ e6 F; D) c; g
       If near_r = .886 then begin 0 @+ h" {% W  a3 p0 I- s" Z
               near_r = NearestFib(ratio("BC","AB")); 1 }9 m7 ^6 B: [; m
               If near_r >= .382 and near_r <= .886 then begin 5 v; W3 U1 K8 T# e
                       targ = CC - 2.24 * (CC - BB); ( ]9 U/ s$ z& I7 i/ }
                       If absvalue(AA-XX) < absvalue(AA-targ) then begin  ! m0 v7 B/ s/ Q- l4 I% b
                               setup = oo_iff(AA>XX,DeepCrab.bullish,DeepCrab.bearish) astype int; % w6 k8 r( u2 V
                               targI = targ; //CC - 2.618 * (CC - BB); 5 o# z0 H# @4 H  c, M0 f- C2 v
                               targO = CC - 3.618 * (CC - BB); 
                               bestConfirm = AA - 1.618 * (AA - XX); 
                               If ShoABeCD then / k+ y. Z; }8 u9 P: v
                                       targCD = DD-(CC-BB); 
                       end; 2 [# S$ J# f1 z  N. @6 g
               end; / s. h& W  V3 N8 ]
       end; 
       Return setup; ( a; X+ `+ u- s# r6 ~) D
end; 
Method int DeepCrabConfirm() ; ^. V- P& \6 a3 @; F5 R* g9 a' {" z, d
var: double near_r; 5 F( c5 x8 S9 D+ n2 b  Q
begin 
       If Pattern = 0 then return 0; 

       near_r = NearestFib(ratio("CD","BC")); 
       If near_r >= 2.24 and near_r <= 3.618 then begin # L& \0 i6 h* e1 T( `5 E
               //print(date:9:0,time:5:0," ...confirmed DeepCrab");                 
               Return pattern.confirmed; 9 ?! T: L. U* I% v* Q: ^
       End else begin 
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide 8 G. s; Z4 \* @- a6 w
               Switch pattern begin + q. b2 F3 D( x# G9 L
               Case DeepCrab.bullish: " N7 V) A. w$ A; I3 N
                       If CC > AA then return pattern.failed; // might happen after limbo ' C8 I* i  _, B  P" X8 K
                       If DD < targO then return pattern.failed; ; C. h  t/ _% h0 Z0 W4 W4 D# C
                       Return pattern.limbo; 1 v6 Y. Z/ V. X! T
               Case DeepCrab.bearish: 
                       If CC < AA then return pattern.failed; // might happen after limbo ) \* h9 X9 g1 H5 z7 I  n3 V5 |
                       If DD > targO then return pattern.failed; 
                       Return pattern.limbo; 
               end; 
       end; 0 K! H* X* Y- s3 C8 v" T- [
       Return 0; 
end; + r9 T# W7 _/ l# R% b' s6 |! D
* N* b8 K; z" v, {5 N+ p
/////////////////////////////////////////////////////////////////////////////   [/ H2 e$ T5 O
// FIVE OH 6 }* v1 f0 t. |6 s$ R
///////////////////////////////////////////////////////////////////////////// % g% q  F4 n* Q3 u# h2 A

Method int FiveOhSetup() ! K0 G$ [4 |* z& H
var: int setup, double near_r; 
begin " l) d! \7 \8 i5 H! s3 S& ^9 t
       if patrn[1] <> 0 then return patrn[1]; // another pattern already snagged 
       setup = 0; 
       near_r = NearestFib(ratio("AB","XA")); 
       If near_r >= 1.13 and near_r <= 1.618 then begin / B% E' d6 Y" ~1 `0 T
               near_r = NearestFib(ratio("BC","AB")); 0 W4 U) h. V) h; N
               If near_r >= 1.618 and near_r <= 2.4 then begin 
                       If True then begin  + z" Y  m1 |' C7 p. R2 f  G& e
                               setup = oo_iff(CC>BB,FiveOh.bullish,FiveOh.bearish) astype int; - H  ^: d) g/ x6 J! c
                               targI = CC - .5 * (CC - BB); 3 N4 ~1 e  D( R# I# o  U; U0 x: ^' ^
                               targO = 0;  8 `  O" Q8 S) b* T
                               bestConfirm = 0; //CC - .5 * (BB - CC); % X: P0 _/ d: z' B* |
                               If ShoABeCD then : S9 ^+ p' d& t" n/ e2 ?
                                       targCD = 0; . D  W( B4 J. A+ j) y& @. K5 u, Z
                       end; 
               end; 9 D8 l* P) P4 M5 O$ M  |) ]/ \- K
       end; 9 T8 ?' T# R- l. R& S& O# L# P
       Return setup; . z2 M3 N- ~) O) `* K, T) ?
end; ! H* e. C; [9 X) N! F# ?" G
Method int FiveOhConfirm() 
var: double near_r; 
begin ! R8 M. P1 T/ I) Z$ ]0 \9 c
       If Pattern = 0 then return 0; 

       near_r = NearestFib(ratio("CD","BC"));  9 J: P2 v( r5 w& w! W
       //If near_r = .5 then begin   BOOK VALUE 1 a" B- n+ n3 z# Z
       If near_r >= .382 and near_r <= .618 then begin // TESTING VALUE 
               //print(date:9:0,time:5:0," ...confirmed FiveOh");                 2 V& ^$ c" _3 c2 g; e
               Return pattern.confirmed; . D' U' O6 u0 Y
       End else begin 
               If (DDb - BBb) > 1.5 * (BBb - XXb) then return pattern.failed; // rhs to wide 7 m1 g" h- h0 Z; t0 D! p/ V
               Switch pattern begin 
               Case FiveOh.bullish: 
                       If CC > AA then return pattern.failed; // might happen after limbo 
                       If DD < targO then return pattern.failed; 
                       Return pattern.limbo; , \: W- A& e, S) o
               Case FiveOh.bearish: $ L( p5 R3 n7 [# }
                       If CC < AA then return pattern.failed; // might happen after limbo 0 R5 G* W. J6 f4 V
                       If DD > targO then return pattern.failed; 
                       Return pattern.limbo; . m! A4 d/ i8 `
               end; 
       end; ) r) v0 A  l( V+ h* k3 u" s" p4 z
       Return 0; 
end; ; k$ T, l5 h1 C
. h4 b! k+ `+ g
///////////////////////////////////////////////////////////////////////////// 
// COMMON METHODS 3 U6 `+ j, g4 a0 ?1 V, k$ w
///////////////////////////////////////////////////////////////////////////// - P7 R5 F0 q5 u

Method double oo_iff( bool q, double valu1, double valu2 ) , t: d( h. b- U4 z
begin 1 q9 [& r' ^7 S! _: x
       if q then return valu1 else return valu2; 6 I+ a: P4 `) Z- a$ j
end; 

Method int oo_dark(int colr, double darkfac) 
var: int oRed, int oGreen, int oBlue; " m% z" m" U) ^. M$ i$ n  |
begin 
       if colr = -1 then return colr; 
       oRed = GetRValue(colr); 
       oGreen = GetGValue(colr); 
       oBlue = GetBValue(colr); $ }( c! [9 ?+ a3 T$ C' ]% {
       if darkfac <= 1 then return rgb( darkfac * oRed, darkfac * oGreen, darkfac * oBlue )   ^: \4 x' f( s+ B1 I4 ?5 D. D
       else return rgb(oRed+(darkfac-1)*(255-oRed),oGreen+(darkfac-1)*(255-oGreen),oBlue+(darkfac-1)*(255-oBlue)); 
end; 1 L3 _4 i9 B1 g& }" O2 A* W5 i( u

Method int oo_PlotString( double price, string ss, int colr, int barsb, int han ) - t3 V. \) S/ {7 f6 ~2 O- E
var: int newhan; / Q, l! B0 Z" K: I
begin , T8 N/ @1 ^" d, U1 a+ s
       newhan = -1; * ^" w! ~1 Q, t, t
       If han = -1 then begin 
               newhan = text_new( date[barsb], time[barsb], price, ss ); + N+ E2 ]; I% [
               text_setcolor( newhan, colr ); 
               text_setstyle( newhan, 1, 2 ); 
               return newhan; 3 ?- x9 N' S0 s3 L+ P- n7 K' A) }
       End else begin 
               text_setstring( han, ss ); 7 \( `0 E7 f% l! b! w& a
               Text_setlocation( han, date[barsb], time[barsb], price ); 0 J& t1 @7 c& x9 O  o& V8 [1 J
               text_setcolor( han, colr ); 1 Y7 s( u* |" M1 X3 ~
               text_setstyle( han, 1, 2 ); 
               return han; ' b3 H- ^) J7 G$ m
       end; * y) d) T* _: c$ S3 ]* T, ?
end; 

Method void PlotLine(int lin, double y1, int x1,  double y2, int x2, int colr, int siz) 
var: int ii, int xii, int dx, double valu, int vcolr; 6 W& ^9 f9 x6 V. l
begin 3 @9 \$ ^; T; B3 S9 ?. r
       dx = x2 - x1; / M) Y& R3 ~# r4 R1 c1 N: D
       vcolr = colr; 
       for ii = 0 to dx begin 1 A% u/ S) ~: E# t+ {3 i) B
               xii = ii + (currentbar - x2); 
               valu = y2-ii*(y2-y1)/dx; + d- `7 i  C( ~' t* U' V  Z  g
               switch lin begin 8 S; ]5 x+ Z" ^/ y7 g) k7 C
               case 0: plot41[xii](valu,"p41",vcolr,default,siz); ) a: `1 [1 s0 y; d
               case 1: plot42[xii](valu,"p42",vcolr,default,siz); 
               case 2: plot43[xii](valu,"p43",vcolr,default,siz); 
               case 3: plot44[xii](valu,"p44",vcolr,default,siz); 
               case 4: plot45[xii](valu,"p45",vcolr,default,siz); : b' E' `; v* a5 K6 b% ]+ A+ A
               case 5: plot46[xii](valu,"p46",vcolr,default,siz); 
               end; 7 D$ y, p: o7 h3 B( N% s7 `: S; M2 ~' S8 X
       end; 
end; 

var: max_B(500); ' y# \4 d+ L+ \3 G) b) F
var: IsTriangle(true); ; }) f' a& R! L% _; R& W( _7 U
var: chkShowBars.Checked(true); * h/ Z/ _7 h& s* N4 Z7 O
Method void FillTriangle(int fil, double y3, int x3, double y2, int x2, double y1, int x1, int colr)   }# c7 c5 Z/ c
var: double dy12, double dy13, double dy23, int ii, int ij, int vcolr, int siz, 
       int bb, double minl, double maxl; 
begin  
       siz = GetAppInfo(aibarspacing) astype int - 1; 

       vcolr = colr;  
       if colr = black then return; 
       if x2-x1 > 0 then dy12 = (y2-y1)/(x2-x1); 
       if x3-x1 > 0 then dy13 = (y3-y1)/(x3-x1); ' p, V, C( J8 d; @! v
       if x3-x2 > 0 then dy23 = (y3-y2)/(x3-x2);                 
       switch fil begin 
       case 0: 
               for ii = 0 to x2-x1 begin . |8 m3 b" H$ f$ S& T! d! v
                       bb = currentbar-x1-ii; 
                       plot80[bb](y1+ii*dy13,"p80",vcolr,default,siz); 
                       plot81[bb](y1+ii*dy12,"p81"); 
                       If chkShowBars.Checked then begin 6 b) u( n5 r& ~2 [+ t/ z: u
                               Minl = minlist(y1+ii*dy12, y1+ii*dy13); 
                               Maxl = maxlist(y1+ii*dy12, y1+ii*dy13); $ N# O7 E/ G1 ^2 ?
                               If ShoBars then begin 
                                       If c[bb] > minl and c[bb] < maxl then 
                                               plot4[bb](c[bb],"p4"); 
                                       If L[bb] < maxl And h[bb] > minl then begin 
                                               plot5[bb](minlist(maxl,h[bb]),"p5"); 
                                               plot6[bb](maxlist(minl,l[bb]),"p6"); $ T2 J  a' h; K( ]- `' i% u- v. n, r
                                       end; 5 h2 B8 t% V+ h
                               end; 
                       end; 7 N; D- b1 k6 c, J
               end;   ?* v. ?8 H" d% b: T$ h* h% k  Z
               for ii = 0 to x3-x2 begin 
                       bb = currentbar-x3+ii; 
                       plot80[bb](y3-ii*dy13,"p80",vcolr,default,siz); 
                       plot81[bb](y3-ii*dy23,"p81"); 
                       If chkShowBars.Checked then begin 
                               Minl = minlist(y3-ii*dy13, y3-ii*dy23); 
                               Maxl = maxlist(y3-ii*dy13, y3-ii*dy23); 
                               If ShoBars then begin 4 I/ P- m4 J$ H' j
                                       If c[bb] > minl and c[bb] < maxl then / G% V" F8 w6 S% S; }
                                               plot4[bb](c[bb],"p4"); 
                                       If L[bb] < maxl And h[bb] > minl then begin 
                                               plot5[bb](minlist(maxl,h[bb]),"p5"); - P; p/ T0 c% o+ a* F
                                               plot6[bb](maxlist(minl,l[bb]),"p6"); 
                                       end; 
                               end; " q* z3 W1 ^  R9 E6 m
                       end; / L# A# Q+ H; a+ h5 ^
               end; 
       case 1: ; 
               for ii = 0 to x2-x1 begin 8 d& z1 _7 z# K* \1 h# ]" H
                       bb = currentbar-x1-ii; 
                       plot82[bb](y1+ii*dy13,"p82",vcolr,default,siz); 
                       plot83[bb](y1+ii*dy12,"p83"); $ o* p+ {1 X/ ]3 ]: N0 a
                       If chkShowBars.Checked then begin , {+ L, g  P% _% g) X
                               Minl = minlist(y1+ii*dy13, y1+ii*dy12); " m  u6 l" {# O6 t" q& B) d
                               Maxl = maxlist(y1+ii*dy13, y1+ii*dy12); 
                               If ShoBars then begin 
                                       If c[bb] > minl and c[bb] < maxl then 3 b) q( e0 S) F& J3 e9 x; r
                                               plot4[bb](c[bb],"p4"); 7 E! @4 i* @1 h2 `, m! Z
                                       If L[bb] < maxl And h[bb] > minl then begin 
                                               plot5[bb](minlist(maxl,h[bb]),"p5"); - I) M6 S- N6 N  t- ^. ?# ?5 i
                                               plot6[bb](maxlist(minl,l[bb]),"p6"); $ ]+ B- \' D) m. l  J8 N
                                       end; 6 l: Z$ P; v; L2 m' c
                               end; ) q' E! U6 g; D
                       end; 
               end; # \) T" K" \1 H) J. F  {
               for ii = 0 to x3-x2 begin 
                       plot82[currentbar-x3+ii](y3-ii*dy13,"p82",vcolr,default,siz); 
                       plot83[currentbar-x3+ii](y3-ii*dy23,"p83"); 
               end; 
       end; 

end; 

///////////////////////////////////////////////////////////////////////////// ( L' o- p& G4 B! r: X
// LOCAL METHODS & V. _, r- S" y4 B& f; U% ~
///////////////////////////////////////////////////////////////////////////// 

Method double Ratio(string top, string bot) % e$ g4 o' n# ~* \. B3 t; [
var: double dtop, double dbot, double rat; 7 k% u0 Y1 ]( D) g- Z4 n
Begin 
       rat = 0; ' j0 q2 Q8 d: q
       Switch top begin 2 v2 @( J9 N! e# ]& A
       Case "XA","AX": dtop = XX - AA; 
       Case "AB","AB": dtop = AA - BB; & n' A5 T5 C2 s, b" T
       Case "BC","CB": dtop = BB - CC; 
       Case "CD","DC": dtop = CC - DD; 
       Case "AC","CA": dtop = AA - CC; 
       Case "XD","DX": dtop = XX - DD; 
       end; 
       Switch bot begin 
       Case "XA","AX": dbot = XX - AA; 
       Case "AB","AB": dbot = AA - BB; 
       Case "BC","CB": dbot = BB - CC; ; I7 S& K6 O( b& J" D0 s
       Case "CD","DC": dbot = CC - DD; 
       Case "AC","CA": dbot = AA - CC; 
       Case "XD","DX": dbot = XX - DD; 
       end; 
       If dbot <> 0 then rat = absvalue(dtop/dbot); / m. I" I% R5 ?9 m% b4 s
       Return rat; 
end;         
* ]+ G9 |& z2 l) ?
array: fibs[100](0); 
var: fibs.count(0); 1 s; {/ |# q, {" n. y) J
method void InitFibs() , B( P7 J5 p6 M( O$ ~
var: int ii, int ij; : {0 `6 a9 c3 z3 w! Z* d4 r
begin 
       ii = 0; 
       // primary $ a: ^; _3 S7 L6 l* w' ]* {
       fibs[ii] = .618; ii += 1; 
       fibs[ii] = 1.618; ii += 1; 
       // primary derived 4 K. m2 ~- A5 V" ~) a7 @% Q5 O
       fibs[ii] = .786; ii += 1; 9 V, n( l/ M* X0 z) O  ^
       fibs[ii] = .886; ii += 1; & u% u" j3 ~2 [$ g. K0 x4 A: r, |  j
       fibs[ii] = 1.13; ii += 1; 2 E9 l4 r/ K$ N
       fibs[ii] = 1.27; ii += 1; 7 Q5 q5 A0 W# x
       // complementary derived 
       fibs[ii] = .382; ii += 1;  5 z4 C4 A- t% b* M- t3 H! i
       fibs[ii] = .500; ii += 1;  
       fibs[ii] = .707; ii += 1; 7 R) w+ Q0 s% L$ K
       fibs[ii] = 1.41; ii += 1; 
       fibs[ii] = 2.0; ii += 1; 
       fibs[ii] = 2.24; ii += 1; 3 Z  u7 ?' n( [/ e+ |, |4 C
       fibs[ii] = 2.618; ii += 1; * q7 b7 B( B' P8 \4 E; ^
       fibs[ii] = 3.14; ii += 1; * q  i- `2 D( u* g% M, t4 A& z* G
       fibs[ii] = 3.618; ii += 1; . b& `2 H, B3 X7 m( d
       fibs[ii] = 4.618; ii += 1; 0 p3 I7 j- a0 C
       fibs.count = ii; 3 U! A* u- w: D7 l' U, K
end; 

const: fnear(.07); 
method double NearestFib(double valu) 
var: int ii; 
begin 
       for ii = 0 to fibs.count - 1 begin % f. u' Q# p- t# E/ s) C
               if valu < fibs[ii] * (1+fnear) and valu > fibs[ii] * (1-fnear) then begin 
                       return fibs[ii]; 1 ]3 w& D) W6 C
               end; 
       end; 6 @* F& d! C% r( `5 W
       return valu; 0 S" D' W2 R' ~/ K7 c& ~
end; * v. `7 X6 n4 X9 v9 R" d7 q" _3 J

///////////////////////////////////////////////////////////////////////////// 0 C: Q$ i2 d7 a7 @7 J( [  Z& T
// FOR DEBUGING ) }8 a# L2 p3 _: K
///////////////////////////////////////////////////////////////////////////// 9 A8 L" s# I; q/ N9 F% a( {5 p

once begin 
       var: handl(0), ss(""), itxt(0); 
       array: date1[20](0), time1[20](0), price1[20](0), MyDir[20](0); 

       handl = text_getfirst(2); 
       while handl >= 0 begin 
               ss = upperstr(text_getstring(handl));  6 k0 \: A, I3 `0 `( n! N# _
                 if ss = "BREAK" then begin  6 M- s9 A* d9 i7 z- }
               date1[itxt] = text_getdate(handl); + b: @7 M  E9 Y3 P, T
               time1[itxt] = text_gettime(handl); 
               price1[itxt] = text_getvalue(handl); # t5 s6 u/ ?. n$ L% o3 w
               itxt = itxt + 1; 9 T" [4 K+ J5 \, R
             end; 
             handl = text_getnext(handl,2); { IMPORTANT -- infinite loop if this is missing!  } 
          end; " C) }; D* N. B7 i- F9 G
end; 7 i* Z; n6 j9 u3 q& A% N4 A) y
var: ok2plotsys(false); ok2plotsys = date1[0] = 0 or Date < date1[0] or (Date = date1[0] and time <= time1[0]); 
IF OK2PLOTSYS THEN BEGIN 
0 ?' U$ F1 y! V, w  ~5 ~
///////////////////////////////////////////////////////////////////////////// 0 g5 T/ y/ v# l' C
// CONTINUE 
///////////////////////////////////////////////////////////////////////////// 
2 |4 f. I+ Q4 n, A  V
Once Begin   n7 X- m) P( `
       InitFibs(); 
       Value1 = c[max_b];  ; S4 c. Z* S+ F, g& _( q2 R
end; 
9 o( F- ^7 O* f. B" F. f
var: zighh(0); zighh = highestFC(h,zigback); 
var: zigll(0); zigll = lowestFC(l,zigback); 
var: zigdir(0); If H > zighh[1] then zigdir = 1; If L < zigll[1] then zigdir = -1; + b! _6 k% x, p! w5 O3 ?  I
var: ii(0); 
var: r(0);  
var: near_r(0);  
If zigdir <> zigdir[1] then begin 7 W2 Y) J. j) @. \- w
       For ii = 10 downto 1 begin 9 S7 S5 q' i2 R' F; b
               p[ii] = p[ii-1]; 
               pb[ii] = pb[ii-1]; 
               patrn[ii] = patrn[ii-1]; 
               confrm[ii] = confrm[ii-1]; 3 Y: o- g6 N) N8 Q2 |' @/ P
       end; 
       Switch zigdir begin 
       Case 1: 
               p[0] = zighh; ! ?' O, K2 z# n5 H+ d
               pb[0] = currentbar; : O+ C3 L5 r  ?
               patrn[0] = 0; 4 D- m: G5 S9 T- T
               confrm[0] = 0; 
       Case -1: . u3 \/ T  G# b) t
               p[0] = zigll; 
               pb[0] = currentbar; 
               patrn[0] = 0; 
               confrm[0] = 0; # [% S( C# r( h- R/ Z
       end; 

       XX = p[4]; XXb = pb[4]; 
       AA = p[3]; AAb = pb[3]; 
       BB = p[2]; BBb = pb[2]; 
       CC = p[1]; CCb = pb[1]; 

       If ShoZigZag then . y5 t: T* M5 u# i8 C# F& Q+ X
       If BB > 0 then 
               plotline(5, BB,BBb,  CC,CCb, darkcyan, 1); 
) E: I3 g# v0 M$ X+ U1 Q7 l
       r = ratio("AB","XA"); 0 k/ n! @" |: i% m8 P  s0 F
       near_r = NearestFib(r); 
       If ShoFibLabel then , H! L  }9 N- d. Q( w
               oo_plotstring(BB,numtostr(near_r,3),oo_iff(near_r=r,darkcyan,cyan),currentbar-BBb,-1); ) W* E6 `% N/ R( t9 i( |; d
7 P5 X7 I( u4 U. ~8 u5 m
       // HARMONIC SETUPS 
. C* z: a. Q9 L/ r& N& T
       // The order here reflects the priority of which supersedes which . P! V1 w0 c% n0 d( U) p
       If ShoBat then  , L4 I! M  v: x6 n0 t+ X" V
               patrn[1] = BatSetup(); 3 Q' {) h% O$ s+ K
       If ShoButterfly then 
               patrn[1] = ButterflySetup(); 
       If ShoGartley then : @/ Y2 H, t% N/ I
               patrn[1] = GartleySetup(); " n& I5 F# G( T1 W+ Y$ R  c; A7 b& g
       If ShoCrab then 
               patrn[1] = CrabSetup(); 
       If ShoDeepCrab then $ d1 P0 [5 R9 \$ \# z
               patrn[1] = DeepCrabSetup(); - [$ _) u. [$ O1 E1 p# a
       If ShoFiveOh then  $ u8 D; B( B! g% J6 Z
               patrn[1] = FiveOhSetup(); 0 J) J1 h/ ?0 h, `* _( X
0 g: p  I; o9 |% p
       If patrn[1] <> 0 then begin 
               plot7[currentbar-BBb](BB,"p7",black,default,3); 
               plot8[currentbar-BBb](BB,"p8",cyan,default,5); # G% O" }% o) _" I$ ]3 I2 ~: d' {

               PlotLine(1, XX,XXb, AA,AAb, cyan, 1); ' R: i; k: w; _  F) ?" _* Y
               PlotLine(1, AA,AAb, BB,BBb, cyan, 1); 
               PlotLine(2, XX,XXb, BB,BBb, cyan, 1); ! _0 V- i) w6 ?
               FillTriangle( 1, BB,BBb, AA,AAb, XX,XXb, Darkcyan ); ) X/ J! }" z& l' B  B4 V$ b
        ; t: {9 H* Q6 e  @  R8 K+ M
               PlotLine(1, BB,BBb, CC,CCb, cyan, 1);   
                          1 l+ K% X8 y- e- U* N
               oo_plotstring(targI,"Inner entry ->",cyan,1,-1); 
               oo_plotstring(targO,"Outer entry ->",cyan,1,-1); 
               oo_plotstring(bestConfirm,"Best confirm ->",cyan,1,-1); 
               var: tcolr(getplotcolor(55)); ! g: Q6 h' H6 ~; ]* k5 x
               oo_plotstring(targCD,"AB=CD ->",tcolr,1,-1); 6 |! h  n2 Q! u9 c# J) }4 w
               Switch patrn[1] begin 7 i+ D0 h0 E* P9 M
                       case bat.bullish: oo_plotstring(DD,"Bullish Bat ->",cyan,currentbar-DDb,-1);  . w0 @3 _9 T& ]. G
                       case bat.bearish: oo_plotstring(DD,"Bearish Bat ->",cyan,currentbar-DDb,-1);  : D3 q# x0 w! r6 U  h" Q
                       case butterfly.bullish: oo_plotstring(DD,"Bullish Butterfly ->",cyan,currentbar-DDb,-1);  ! J0 K9 h' l/ Y+ X
                       case butterfly.bearish: oo_plotstring(DD,"Bearish Butterfly ->",cyan,currentbar-DDb,-1);  ( l, d. R6 |# L" I- g! T
                       case gartley.bullish: oo_plotstring(DD,"Bullish Gartley ->",cyan,currentbar-DDb,-1);  
                       case gartley.bearish: oo_plotstring(DD,"Bearish Gartley ->",cyan,currentbar-DDb,-1);  : v7 z3 i4 M& i+ Y
                       case crab.bullish: oo_plotstring(DD,"Bullish Crab ->",cyan,currentbar-DDb,-1);    y$ f& _/ i" O; ]
                       case crab.bearish: oo_plotstring(DD,"Bearish Crab ->",cyan,currentbar-DDb,-1);  
                       case deepcrab.bullish: oo_plotstring(DD,"Bullish Deep Crab ->",cyan,currentbar-DDb,-1);  ( n  n8 D; ~* q
                       case deepcrab.bearish: oo_plotstring(DD,"Bearish Deep Crab ->",cyan,currentbar-DDb,-1);  4 B; T5 r4 F+ ?! w4 R2 u6 @7 I7 u
                       case fiveoh.bullish: oo_plotstring(DD,"Bullish 5-O ->",cyan,currentbar-DDb,-1);  
                       case fiveoh.bearish: oo_plotstring(DD,"Bearish 5-O ->",cyan,currentbar-DDb,-1);  
               end; * ?6 R# W, _0 m: w3 J2 ]# W/ l
       end; 8 p3 M& M, M7 K5 {% v

6 `! Q" a! r) d& A, B
       // HARMONIC CONFIRMATIONS 

       XX = p[5]; XXb = pb[5]; , K( Q5 n5 j' ?) G$ I0 D, Y4 X
       AA = p[4]; AAb = pb[4];   [- E9 x4 o3 n. r) Z5 B# f- W6 O
       BB = p[3]; BBb = pb[3]; 
       CC = p[2]; CCb = pb[2]; 
       DD = p[1]; DDb = pb[1]; 5 I. E! [  i2 Q1 _- h7 T
       EE = p[0]; EEb = pb[0]; 
% f) @3 v, m/ M; N" e
       If confrm[4] = pattern.limbo then begin // special continuation case 
               var: XX2(0), XX2b(0); XX2 = p[7]; XX2b = pb[7]; 
               var: AA2(0), AA2b(0); AA2 = p[6]; AA2b = pb[6]; 
               var: BB2(0), BB2b(0); BB2 = p[5]; BB2b = pb[5]; 
               var: CC2(0), CC2b(0); CC2 = p[4]; CC2b = pb[4]; 
               var: Pattern2(0); Pattern2 = patrn[4];   F+ [9 k+ @' @: M' y9 f* t! S4 E
6 B# K3 _+ J+ R
               For ii = 1 to 8 begin 
                       p[ii] = p[ii+2]; 
                       pb[ii] = pb[ii+2]; % {2 B7 T( r# k' B# ^7 S
                       patrn[ii] = patrn[ii+2]; 
                       confrm[ii] = confrm[ii+2]; 
               end; ; i5 Z. Z. v( ~! q/ N
 " x6 {) w  k' `' O1 {1 b8 x, A1 P
               If Pattern2 > 0 then begin // bullish 
                       If BB < DD then begin p[1] = BB; pb[1] = BBb; end + [% A6 G5 [) x0 e5 ]* k
                               Else begin p[1] = DD; pb[1] = DDb; end; 
                       If CC > AA then begin p[2] = CC; pb[2] = CCb; end 1 H5 ~) X! ^( i/ _: j/ s  ]
                               Else begin p[2] = AA; pb[2] = AAb; end; ) |% U" u( B/ E, I$ \! g/ o& P/ ^
                       plotline(3, p[2],pb[2], p[1],pb[1], darkcyan,2); * f. L, p% a- @4 F2 ?
               End else if Pattern2 < 0 then begin // bearish 
                       If BB > DD then begin p[1] = BB; pb[1] = BBb; end 9 K& m5 B# Q5 p0 {; t+ s: r/ a2 Q: G" t
                               Else begin p[1] = DD; pb[1] = DDb; end; 0 d/ ~# `1 j2 f. B# l5 I
                       If CC < AA then begin p[2] = CC; pb[2] = CCb; end ' b% l% l' |  x5 K/ J8 `% v
                               Else begin p[2] = AA; pb[2] = AAb; end; 
                       plotline(3, p[2],pb[2], p[1],pb[1], darkcyan,2); - ]. A# ~( ]5 S; }
               End else print("!!!error"); . R- ^! C; z9 \( z) h$ c
 % Q! s4 [7 H9 [& s' G
       end; ( T1 L/ J3 @% D7 J

       XX = p[5]; XXb = pb[5]; 
       AA = p[4]; AAb = pb[4]; 
       BB = p[3]; BBb = pb[3]; 
       CC = p[2]; CCb = pb[2]; : b: Z2 g- W* P  @! Q: z% r! _
       DD = p[1]; DDb = pb[1]; 1 V& e) N( k2 l% P" A8 k
       EE = p[0]; EEb = pb[0]; 3 D  y. f% h& j1 ]  n3 y) h/ Z, u
       Pattern = patrn[2]; 0 |( t2 v9 e8 I' J+ m

       Switch Pattern begin 6 U# [. U' T  W9 P8 Z4 I. \
       Case bat.bullish,bat.bearish: confrm[2] = BatConfirm(); ' z5 f) M/ ~1 Z( n! S
       Case butterfly.bullish,butterfly.bearish: confrm[2] = ButterflyConfirm(); 
       Case gartley.bullish,gartley.bearish: confrm[2] = GartleyConfirm(); ' r: |2 J. i4 F
       Case crab.bullish,crab.bearish: confrm[2] = CrabConfirm(); 2 h6 T, J2 A9 }  f# N9 T8 U9 Q9 r
       Case deepcrab.bullish,deepcrab.bearish: confrm[2] = DeepCrabConfirm(); 5 S8 f6 N3 n* l; M: I1 s
       Case fiveoh.bullish,fiveoh.bearish: confrm[2] = FiveOhConfirm(); 
       end; 1 e( k, S8 n; f/ J+ a
$ @0 T) o  x/ @' q/ ^0 D
       If confrm[2] <> 0 then  0 v& ?* g; H9 d7 A
       Switch confrm[2] begin 
       Case pattern.failed: - D; d( d+ |5 T, a! }5 p2 N
               Value1 = oo_plotstring(EE,"pattern failure ->",cyan,currentbar-EEb,-1); 2 o, i' [2 M, m4 V& K% f( r
               targI = 0; 
               targO = 0; , \$ D+ q( S- p5 S6 x9 a
               targCD = 0; # t+ M8 y1 k" J; ?2 q- ?
               bestConfirm = 0; 
       Case pattern.limbo: * I* o6 G0 }: M# v9 I
               Value1 = oo_plotstring(EE,"pattern continuing ->",cyan,currentbar-EEb,-1); 
       Case pattern.confirmed: ; . d5 h' s' I( t8 B3 d. g7 f
               PlotLine(3, CC,CCb, DD,DDb, cyan, 1); ) O. {; c$ B6 T, s% \$ S7 g, q  L& c
               PlotLine(3, BB,BBb, CC,CCb, cyan, 1); ) E6 O( d; v, i1 [$ {0 {4 f
               PlotLine(4, BB,BBb, DD,DDb, cyan, 1); 
               FillTriangle( 0, DD,DDb, CC,CCb, BB,BBb, oo_iff(pattern<0,BearishColor,BullishColor) ); : r# W! B; `* Z, R7 r! Q7 _" w
5 g* G0 x& h% m% k3 Y0 C( [
               targI = 0; 4 O& Z, R% K; Z  k' N  N3 w7 G
               targO = 0; / a4 Z9 {& L  v& C' T
               targCD = 0; 
               bestConfirm = 0; 5 Z* B5 I" `# E% X4 E) o2 j& X7 o
       default: ; O" Z5 {; a; `
               Value1 = oo_plotstring(EE,"???",cyan,currentbar-EEb,-1); 5 d' Z- k& T. n$ }# }) j
               print("pattern ???"); 
       end; 
end; 1 ?: w6 G; X( T/ \* T5 E& d7 x4 N

Switch zigdir begin 
Case 1: If p[0] < H then begin p[0] = h; pb[0] = currentbar; end; 1 X$ K* m& t7 r, G
Case -1: If p[0] > l then begin p[0] = l; pb[0] = currentbar; end; 
end; 
}
If ShoZZBands then begin 
       plot51(zighh,"p51",oo_iff(zigdir=1,green,red)); 6 y( U8 Y) `" `4 l3 P3 _
       plot52(zigll,"p52",oo_iff(zigdir=1,green,red)); ; i, ^4 T) K: O% Y, u
end; 4 o3 h7 N" Q: F8 ^
& f- e9 o/ B! O6 P4 J
if targI > 0 then plot53(targI,"p53",cyan); 
if targO > 0 then plot54(targO,"p54",cyan);  
if targCD > 0 then plot55(targCD,"p55");  
if bestConfirm > 0 then plot56(bestConfirm,"p56");  2 @# F  [0 V, }$ i3 W . y! \; ^  G! @8 E2 o$ oEND; 
 } }

Share this post


Link to post
Share on other sites

Hi Traders Laboratory

Mr zdo Thank you again for your time and patiance with this question

 

If anyone has access to the TradeStation Forum

the original artical is there re Marsella Marceau code pages1,2.3 ref:: Easylanguage Library

Link below:

 

https://community.tradestation.com/discussions/SearchResult.aspx?txtAll=&txtExact=&txtOr=&txtNot=&txtAuthor=MarsallaMarceau&radioAuthor=0&selAuthor=0&radioScope=0&selForum=0&selSortField=1&SelSortOrder=1&cbArchive=1&selFrom=-1&RadioResult=0&selResultCount=200&Session_ID=163816-00000000

 

Best regards

Derek

Edited by derek2209
http link corropted

Share this post


Link to post
Share on other sites

Hi Trader Laboratory

 

Thank you to zdo Market Wizard for his referring to the work of Marsalla Marceau

and to Marsalla Marceau for his great work on code writing of Auto Harmonics

 

I have attached the TS ELD using the original name

"2014123002314120121230 AUTOHARMONICS "

and a text file Auto Harmonics.txt

 

I used TradeStation 9.1 to verify the code and draw the Charts

If you do not get a plot of the indicator try loading more price bars

 

Also a screen shot of Formating the Indicator Parameters

I would like someone to advise on setting up the Indicator Parameters

And three screen shots of the Indicator

I hope that the attachments travel ok

 

Best regards

Derek

2014123002314120121230 AUTOHARMONICS.ELD

Auto Harmonics.txt

5aa7129dbb5fb_AutoHarmonics.thumb.PNG.34a4c19dbe4910354eee81e39771da3b.PNG

5aa7129e293b9_DJIAutoHarmonics.jpg.2d4e62d444399ad3c5c55329ea0beaa5.jpg

5aa7129e2fd20_DaxAutoHarmonics.jpg.3190c1075b61370ceb537d25a64a42ad.jpg

5aa7129e373e6_GoldAutoHarmonics.jpg.741fab325b6783c6796fa72fab26f400.jpg

Edited by derek2209

Share this post


Link to post
Share on other sites

Marsalla Marceau is no longer using Tradestation and the indicator is a work in progress. The Butterfly indicator seems to be as well. However there both worth having but I like to watch Tams's in a 30 minute chart.

surinotes sells an abc indicator worth having however you wouldn't be able to see the code! Most of the harmonic code logic seems to be well guarded . However some information is out there to kick start your efforts!

I would add a PRZ zone and fib zone to Tams's and Marsalla's indicator and go from there. May I add that Patterns are not the holy grail.Patterns work and they fail as well!

MQ4 indicator and pdf down below .

5ae3466b89b04_ESH184-29-18.thumb.jpg.d61329cd08ea38b18d628b5e8e669796.jpg

PRZ Backtesting with Harmonic Pattern Plus_v1.0.pdf

Harmonic.indicator.zip

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Date: 11th June 2024. Market News – Inflation reports dominates! Economic Indicators & Central Banks:   The selloff in Treasuries continued ahead of the FOMC decision tomorrow, though losses were moderate. Disappointment that the continued strength in the labor market will push back any easing until at least September at the earliest continued to weigh. Chinese stocks dropped after traders returned from a long weekend, weighed down by weak travel spending and renewed concerns over the property sector, raising doubts about the sustainability of China’s economic recovery. Developer Dexin China Holdings gets liquidation order from a Hong Kong court adding to a growing number of legal victories for creditors involving overdue debt. Geopolitical risks also affected shares of electric vehicle makers as traders awaited the European Commission’s decision on provisional duties expected this week. Australian business confidence turned negative in May, and conditions slipped to below-average levels, indicating that elevated interest rates and a worsening consumer outlook are weighing on the corporate sector. Markets are also closely monitoring potential fallout from political upheavals in Europe. Asian & European Open: All three major indexes closed higher on Monday, with the S&P500 and Nasdaq both hitting new records. The Dow ended the day up about 0.2%, following a modest finish to a winning week. The CSI 300 Index of mainland shares fell up to 1.4% after reopening from the Dragon Boat Festival holiday, while Hong Kong-listed Chinese shares were among Asia’s biggest decliners, dropping as much as 2%. Apple Inc. sank despite unveiling new artificial intelligence features. The company’s suppliers also dropped after Apple’s latest AI platform was seen as disappointing. Billionaire Elon Musk stated he would ban Apple devices from his companies if OpenAI’s software is integrated at the operating system level, calling it a security risk. Financial Markets Performance: The USDIndex has caught a bid with the push back to rate cut expectations. It closed at 105.150, back with a 105 handle for the first time since May 14. The EURUSD stalled at 1.0770, while GBPUSD declined slightly today after the tight labor data. USOIL held the biggest jump since March ahead of an OPEC report that will provide a snapshot on the market outlook. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Andria Pichidi Market Analyst HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • WGS GeneDx stock strong trend, watch for a continuation breakout above 28.32, https://stockconsultant.com/?WGS
    • PSFE Paysafe stock narrow range breakout watch above 18.85, https://stockconsultant.com/?PSFE
    • GTE Gran Tierra Energy stock great day! https://stockconsultant.com/?GTE
    • GM General Motors stock huge top of range breakout, from Stocks To Watch, https://stockconsultant.com/?GM  
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.