-
Notifications
You must be signed in to change notification settings - Fork 3
/
longleggeddoji.go
47 lines (40 loc) · 994 Bytes
/
longleggeddoji.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package golangcandles
import (
"math"
"github.com/go-gota/gota/dataframe"
)
func LongLeggedDoji(df dataframe.DataFrame) (output int) {
ohlc_4 := GenerateOhcl(df, 4)
ohlc_3 := GenerateOhcl(df, 3)
ohlc_2 := GenerateOhcl(df, 2)
ohlc_1 := GenerateOhcl(df, 1)
// BEAR
if ohlc_4.Close > ohlc_4.Open {
if ohlc_3.Close > ohlc_3.Open {
if ohlc_2.Close > ohlc_2.Open {
if math.Abs((ohlc_1.Close-ohlc_1.Open)/ohlc_1.Open) < 0.1 {
if math.Abs((ohlc_1.High-ohlc_1.Open)/ohlc_1.Open) > 0.2 {
if math.Abs((ohlc_1.Close-ohlc_1.Low)/ohlc_1.Low) > 0.2 {
output = -100
}
}
}
}
}
}
// BULL
if ohlc_4.Close < ohlc_4.Open {
if ohlc_3.Close < ohlc_3.Open {
if ohlc_2.Close < ohlc_2.Open {
if math.Abs((ohlc_1.Open-ohlc_1.Close)/ohlc_1.Close) < 0.1 {
if math.Abs((ohlc_1.Low-ohlc_1.Close)/ohlc_1.Close) > 0.2 {
if math.Abs((ohlc_1.Open-ohlc_1.High)/ohlc_1.High) > 0.2 {
output = 100
}
}
}
}
}
}
return
}