-
Notifications
You must be signed in to change notification settings - Fork 0
/
indicators.go
77 lines (66 loc) · 1.56 KB
/
indicators.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package shingo
// Indicators provides indicator type for each candlestick
type Indicators struct {
SMAs map[int]*SMADelta
EMAs map[int]*EMADelta
MACDs map[int]map[int]map[int]*MACDDelta
IchimokuClouds map[string]*IchimokuCloudDelta
ATRs map[int]*ATRDelta
SuperTrends map[int]map[float64]*SuperTrendDelta
HeikinAshi *HeikinAshiDelta
StdDevs map[int]*StdDevDelta
Highest map[int]*float64
Lowest map[int]*float64
}
// SMADelta is the value for this period and change since last period
type SMADelta struct {
Value float64
Change float64
}
// EMADelta is the value for this period and change since last period
type EMADelta struct {
Value float64
Change float64
}
// MACDDelta provides macd, signal and histogram for this candlestick
type MACDDelta struct {
MACDValue float64
SignalValue float64
MACDHistogram float64
}
// IchimokuCloudDelta provides ichimoku cloud indicator for this candlestick
type IchimokuCloudDelta struct {
Tenkan float64
Kijun float64
SenkouA float64
SenkouB float64
Chikou float64
}
// ATRDelta provides average true range for this candlestick
type ATRDelta struct {
Value float64
Change float64
}
type SuperTrendDelta struct {
Longband float64
Shortband float64
Trend Trend
}
type HeikinAshiDelta struct {
Open float64
High float64
Low float64
Close float64
}
type StdDevDelta struct {
Value float64
}
type Trend int
const (
// Undeterminable trend
Undeterminable Trend = 0
// Bear market
Bear Trend = 1
// Bull market
Bull Trend = 2
)