Created
September 28, 2022 04:32
-
-
Save austin362667/d96b8f425a01a91fc893dccae96819a6 to your computer and use it in GitHub Desktop.
Harmonic Pattern Strategy: Shark Long
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (s Harmonic) SharkLong(highs, lows *types.Queue, p float64) float64 { | |
score := 0. | |
for x := 5; x < 300; x++ { | |
X := lows.Index(x) | |
for a := 4; a < x; a++ { | |
if highs.Index(a-1) < highs.Index(a) && highs.Index(a) > highs.Index(a+1) { | |
A := highs.Index(a) | |
XA := math.Abs(X - A) | |
hB := A - 0.382*XA | |
lB := A - 0.618*XA | |
for b := 3; b < a; b++ { | |
if lows.Index(b-1) > lows.Index(b) && lows.Index(b) < lows.Index(b+1) { | |
B := lows.Index(b) | |
if hB > B && B > lB { | |
//log.Infof("got point B:%f", B) | |
AB := math.Abs(A - B) | |
hC := B + 1.618*AB | |
lC := B + 1.13*AB | |
for c := 2; c < b; c++ { | |
if highs.Index(c-1) < highs.Index(c) && highs.Index(c) > highs.Index(c+1) { | |
C := highs.Index(c) | |
if hC > C && C > lC { | |
//log.Infof("got point C:%f", C) | |
XC := math.Abs(X - C) | |
hD := C - 0.886*XC | |
lD := C - 1.13*XC | |
//for d := 1; d < c; d++ { | |
//if lows.Index(d-1) > lows.Index(d) && lows.Index(d) < lows.Index(d+1) { | |
D := p //lows.Index(d) | |
if hD > D && D > lD { | |
BC := math.Abs(B - C) | |
hD2 := C - 1.618*BC | |
lD2 := C - 2.24*BC | |
if hD2 > D && D > lD2 { | |
//log.Infof("got point D:%f", D) | |
score++ | |
} | |
} | |
//} | |
//} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
return score | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment