quantitative 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/quant/indicators/indicator.rb +13 -57
- data/lib/quant/indicators/indicator_point.rb +11 -0
- data/lib/quant/indicators/pivots/atr.rb +10 -16
- data/lib/quant/indicators/pivots/bollinger.rb +8 -25
- data/lib/quant/indicators/pivots/camarilla.rb +29 -28
- data/lib/quant/indicators/pivots/classic.rb +1 -1
- data/lib/quant/indicators/pivots/demark.rb +3 -3
- data/lib/quant/indicators/pivots/donchian.rb +19 -23
- data/lib/quant/indicators/pivots/fibbonacci.rb +11 -10
- data/lib/quant/indicators/pivots/keltner.rb +10 -19
- data/lib/quant/indicators/pivots/murrey.rb +6 -13
- data/lib/quant/indicators/pivots/pivot.rb +8 -8
- data/lib/quant/version.rb +1 -1
- data/lib/quantitative.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5980a746b36ba0ee44bbd6117df75040a94969c5f00e1129d0f74aa1772b5013
|
4
|
+
data.tar.gz: 88fff74e34d1c446d252f9750bb5363828a448b9b326904fefa41499318fdb20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57dd5832cf3aceaac7fda15fe2cec89fb615387205fcbbfd2dcb20ed2241bde58648aaa5b87f6bf605e2f827086613e7309d4e71bffdf60d786e2d71038a146f
|
7
|
+
data.tar.gz: f80357622cd7cbcee2d13d5439b0423aa0aab9006d3a1aedfd215d8690cf5cc158a9c10990b5ecb933322d5784709c258daa26ccaa0c51ea4808e36ee35554a2
|
data/Gemfile.lock
CHANGED
@@ -98,9 +98,18 @@ module Quant
|
|
98
98
|
series.indicators[source][dominant_cycle_indicator_class]
|
99
99
|
end
|
100
100
|
|
101
|
-
|
101
|
+
# The adaptive period is the full dominant cycle period
|
102
|
+
def adaptive_period
|
102
103
|
dominant_cycle.points[t0].period
|
103
104
|
end
|
105
|
+
alias dc_period adaptive_period
|
106
|
+
alias dominant_cycle_period adaptive_period
|
107
|
+
|
108
|
+
def adaptive_half_period
|
109
|
+
adaptive_period / 2
|
110
|
+
end
|
111
|
+
alias dc_half_period adaptive_half_period
|
112
|
+
alias dominant_half_cycle_period adaptive_half_period
|
104
113
|
|
105
114
|
def ticks
|
106
115
|
@points.keys
|
@@ -193,67 +202,14 @@ module Quant
|
|
193
202
|
t0.send(source)
|
194
203
|
end
|
195
204
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
# attr_reader :dc_period
|
201
|
-
|
202
|
-
# def points_for(series:)
|
203
|
-
# @points_for_cache[series] ||= self.class.new(series:, settings:, cloning: true).tap do |indicator|
|
204
|
-
# series.ticks.each { |tick| indicator.points.push(tick.indicators[self]) }
|
205
|
-
# end
|
206
|
-
# end
|
207
|
-
|
208
|
-
# # Ticks belong to the first series they're associated with always
|
209
|
-
# # NOTE: No provisions for series merging their ticks to one series!
|
210
|
-
# def parent_series
|
211
|
-
# series.ticks.empty? ? series : series.ticks.first.series
|
212
|
-
# end
|
213
|
-
|
214
|
-
# # Returns the last point of the current indicator rather than the entire series
|
215
|
-
# # This is used for indicators that depend on dominant cycle or other indicators
|
216
|
-
# # to compute their data points.
|
217
|
-
# def current_point
|
218
|
-
# points.size - 1
|
219
|
-
# end
|
220
|
-
|
221
|
-
# def dominant_cycles
|
222
|
-
# parent_series.indicators.dominant_cycles
|
223
|
-
# end
|
224
|
-
|
225
|
-
# # Override this method to change source of dominant cycle computation for an indicator
|
226
|
-
# def dominant_cycle_indicator
|
227
|
-
# @dominant_cycle_indicator ||= dominant_cycles.band_pass
|
228
|
-
# end
|
229
|
-
|
230
|
-
# def ensure_not_dominant_cycler_indicator
|
231
|
-
# return unless is_a? Quant::Indicators::DominantCycles::DominantCycle
|
232
|
-
|
233
|
-
# raise 'Dominant Cycle Indicators cannot use the thing they compute!'
|
234
|
-
# end
|
235
|
-
|
236
|
-
# # Returns the dominant cycle point for the current indicator's point
|
237
|
-
# def current_dominant_cycle
|
238
|
-
# dominant_cycle_indicator[current_point]
|
239
|
-
# end
|
205
|
+
def warmed_up?
|
206
|
+
ticks.size > min_period
|
207
|
+
end
|
240
208
|
|
241
209
|
# # Returns the atr point for the current indicator's point
|
242
210
|
# def atr_point
|
243
211
|
# parent_series.indicators.atr[current_point]
|
244
212
|
# end
|
245
|
-
|
246
|
-
# # def dc_period
|
247
|
-
# # dominant_cycle.period.round(0).to_i
|
248
|
-
# # end
|
249
|
-
|
250
|
-
# def <<(ohlc)
|
251
|
-
# points.append(ohlc)
|
252
|
-
# end
|
253
|
-
|
254
|
-
# def append(ohlc)
|
255
|
-
# points.append(ohlc)
|
256
|
-
# end
|
257
213
|
end
|
258
214
|
end
|
259
215
|
end
|
@@ -27,6 +27,17 @@ module Quant
|
|
27
27
|
def_delegator :indicator, :dominant_cycle_kind
|
28
28
|
def_delegator :indicator, :pivot_kind
|
29
29
|
|
30
|
+
def_delegator :tick, :high_price
|
31
|
+
def_delegator :tick, :low_price
|
32
|
+
def_delegator :tick, :close_price
|
33
|
+
def_delegator :tick, :open_price
|
34
|
+
def_delegator :tick, :volume
|
35
|
+
def_delegator :tick, :trades
|
36
|
+
|
37
|
+
def oc2
|
38
|
+
tick.respond_to?(:oc2) ? tick.oc2 : tick.close_price
|
39
|
+
end
|
40
|
+
|
30
41
|
def initialize_data_points
|
31
42
|
# No-Op - Override in subclass if needed.
|
32
43
|
end
|
@@ -10,31 +10,25 @@ module Quant
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def scale
|
13
|
-
|
13
|
+
3.0
|
14
14
|
end
|
15
15
|
|
16
16
|
def atr_value
|
17
|
-
atr_point.
|
17
|
+
atr_point.value * scale
|
18
18
|
end
|
19
19
|
|
20
20
|
def compute_midpoint
|
21
|
-
p0.midpoint =
|
21
|
+
p0.midpoint = smoothed_average_midpoint
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
p0.h6 = p0.midpoint + 1.000 * atr_value
|
26
|
-
p0.h5 = p0.midpoint + 0.786 * atr_value
|
27
|
-
p0.h4 = p0.midpoint + 0.618 * atr_value
|
28
|
-
p0.h3 = p0.midpoint + 0.500 * atr_value
|
29
|
-
p0.h2 = p0.midpoint + 0.382 * atr_value
|
30
|
-
p0.h1 = p0.midpoint + 0.236 * atr_value
|
24
|
+
ATR_SERIES = [0.236, 0.382, 0.500, 0.618, 0.786, 1.0].freeze
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
26
|
+
def compute_bands
|
27
|
+
ATR_SERIES.each_with_index do |ratio, index|
|
28
|
+
offset = ratio * atr_value
|
29
|
+
p0[index + 1] = p0.midpoint + offset
|
30
|
+
p0[-index - 1] = p0.midpoint - offset
|
31
|
+
end
|
38
32
|
end
|
39
33
|
end
|
40
34
|
end
|
@@ -9,37 +9,20 @@ module Quant
|
|
9
9
|
using Quant
|
10
10
|
|
11
11
|
def compute_midpoint
|
12
|
-
values = period_points(
|
13
|
-
alpha = bars_to_alpha(
|
12
|
+
values = period_points(adaptive_half_period).map(&:input)
|
13
|
+
alpha = bars_to_alpha(adaptive_half_period)
|
14
14
|
|
15
15
|
p0.midpoint = alpha * values.mean + (1 - alpha) * p1.midpoint
|
16
16
|
p0.std_dev = values.standard_deviation(p0.midpoint)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
p0.h1 = p0.midpoint + p0.std_dev * 1.0
|
21
|
-
p0.l1 = p0.midpoint - p0.std_dev * 1.0
|
22
|
-
|
23
|
-
p0.h2 = p0.midpoint + p0.std_dev * 1.5
|
24
|
-
p0.l2 = p0.midpoint - p0.std_dev * 1.5
|
25
|
-
|
26
|
-
p0.h3 = p0.midpoint + p0.std_dev * 1.75
|
27
|
-
p0.l3 = p0.midpoint - p0.std_dev * 1.75
|
28
|
-
|
29
|
-
p0.h4 = p0.midpoint + p0.std_dev * 2.0
|
30
|
-
p0.l4 = p0.midpoint - p0.std_dev * 2.0
|
19
|
+
BOLLINGER_SERIES = [1.0, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0].freeze
|
31
20
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
p0.h7 = p0.midpoint + p0.std_dev * 2.75
|
39
|
-
p0.l7 = p0.midpoint - p0.std_dev * 2.75
|
40
|
-
|
41
|
-
p0.h8 = p0.midpoint + p0.std_dev * 3.0
|
42
|
-
p0.l8 = p0.midpoint - p0.std_dev * 3.0
|
21
|
+
def compute_bands
|
22
|
+
BOLLINGER_SERIES.each_with_index do |ratio, index|
|
23
|
+
p0[index + 1] = p0.midpoint + ratio * p0.std_dev
|
24
|
+
p0[-index - 1] = p0.midpoint - ratio * p0.std_dev
|
25
|
+
end
|
43
26
|
end
|
44
27
|
end
|
45
28
|
end
|
@@ -7,51 +7,52 @@ module Quant
|
|
7
7
|
# input the previous day’s open, high, low and close. The formulas for each
|
8
8
|
# resistance and support level are:
|
9
9
|
#
|
10
|
-
# R4 =
|
11
|
-
# R3 =
|
12
|
-
# R2 =
|
13
|
-
# R1 =
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
10
|
+
# R4 = Closing + ((High -Low) x 1.5000)
|
11
|
+
# R3 = Closing + ((High -Low) x 1.2500)
|
12
|
+
# R2 = Closing + ((High -Low) x 1.1666)
|
13
|
+
# R1 = Closing + ((High -Low x 1.0833)
|
14
|
+
# PP = (High + Low + Closing) / 3
|
15
|
+
# S1 = Closing – ((High -Low) x 1.0833)
|
16
|
+
# S2 = Closing – ((High -Low) x 1.1666)
|
17
|
+
# S3 = Closing – ((High -Low) x 1.2500)
|
18
|
+
# S4 = Closing – ((High-Low) x 1.5000)
|
19
|
+
#
|
20
|
+
# R5 = R4 + 1.168 * (R4 – R3)
|
21
|
+
# R6 = (High/Low) * Close
|
22
|
+
# S5 = S4 – 1.168 * (S3 – S4)
|
23
|
+
# S6 = Close – (R6 – Close)
|
18
24
|
#
|
19
25
|
# The calculation for further resistance and support levels varies from this
|
20
26
|
# norm. These levels can come into play during strong trend moves, so it’s
|
21
27
|
# important to understand how to identify them. For example, R5, R6, S5 and S6
|
22
28
|
# are calculated as follows:
|
23
29
|
#
|
24
|
-
#
|
25
|
-
# R6 = (High/Low) * Close
|
26
|
-
#
|
27
|
-
# S5 = S4 – 1.168 * (S3 – S4)
|
28
|
-
# S6 = Close – (R6 – Close)
|
30
|
+
# source: https://tradingstrategyguides.com/camarilla-pivot-trading-strategy/
|
29
31
|
class Camarilla < Pivot
|
30
32
|
register name: :camarilla
|
31
33
|
|
32
34
|
def compute_midpoint
|
33
|
-
p0.midpoint = t0.
|
35
|
+
p0.midpoint = t0.hlc3
|
34
36
|
end
|
35
37
|
|
36
38
|
def compute_bands
|
37
|
-
|
38
|
-
|
39
|
+
p0.h1 = t0.close_price + p0.range * 1.083
|
40
|
+
p0.l1 = t0.close_price - p0.range * 1.083
|
41
|
+
|
42
|
+
p0.h2 = t0.close_price + p0.range * 1.167
|
43
|
+
p0.l2 = t0.close_price - p0.range * 1.167
|
39
44
|
|
40
|
-
p0.
|
41
|
-
p0.
|
42
|
-
p0.h2 = mp_plus_range * (1.1 / 6.0)
|
43
|
-
p0.h1 = mp_plus_range * (1.1 / 12.0)
|
45
|
+
p0.h3 = t0.close_price + p0.range * 1.250
|
46
|
+
p0.l3 = t0.close_price - p0.range * 1.250
|
44
47
|
|
45
|
-
p0.
|
46
|
-
p0.
|
47
|
-
p0.l3 = mp_minus_range * (1.1 / 4.0)
|
48
|
-
p0.l4 = mp_minus_range * (1.1 / 2.0)
|
48
|
+
p0.h4 = t0.close_price + p0.range * 1.500
|
49
|
+
p0.l4 = t0.close_price - p0.range * 1.500
|
49
50
|
|
50
|
-
p0.h5 = p0.h4 + 1.
|
51
|
-
p0.
|
51
|
+
p0.h5 = p0.h4 + 1.68 * (p0.h4 - p0.h3)
|
52
|
+
p0.l5 = p0.l4 - 1.68 * (p0.l3 - p0.l4)
|
52
53
|
|
53
|
-
p0.
|
54
|
-
p0.l6 =
|
54
|
+
p0.h6 = (t0.high_price / t0.low_price) * t0.close_price
|
55
|
+
p0.l6 = t0.close_price - (p0.h6 - t0.close_price)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end
|
@@ -36,15 +36,15 @@ module Quant
|
|
36
36
|
|
37
37
|
def compute_midpoint
|
38
38
|
p0.midpoint = p0.input / 4.0
|
39
|
-
p0.midpoint =
|
39
|
+
p0.midpoint = three_pole_super_smooth :midpoint, previous: :midpoint, period: averaging_period
|
40
40
|
end
|
41
41
|
|
42
42
|
def compute_bands
|
43
43
|
p0.h1 = (p0.input / 2.0) - p0.avg_high
|
44
|
-
p0.h1 =
|
44
|
+
p0.h1 = three_pole_super_smooth :h1, previous: :h1, period: averaging_period
|
45
45
|
|
46
46
|
p0.l1 = (p0.input / 2.0) - p0.avg_low
|
47
|
-
p0.l1 =
|
47
|
+
p0.l1 = three_pole_super_smooth :l1, previous: :l1, period: averaging_period
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -5,35 +5,31 @@ module Quant
|
|
5
5
|
module Pivots
|
6
6
|
class Donchian < Pivot
|
7
7
|
register name: :donchian
|
8
|
-
using Quant
|
9
8
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def st_highs; @st_highs ||= [].max_size!(st_period) end
|
15
|
-
def st_lows; @st_lows ||= [].max_size!(st_period) end
|
16
|
-
def mt_highs; @mt_highs ||= [].max_size!(mt_period) end
|
17
|
-
def mt_lows; @mt_lows ||= [].max_size!(mt_period) end
|
18
|
-
def lt_highs; @lt_highs ||= [].max_size!(lt_period) end
|
19
|
-
def lt_lows; @lt_lows ||= [].max_size!(lt_period) end
|
9
|
+
def compute_midpoint
|
10
|
+
p0.midpoint = (p0.high_price + p0.low_price) * 0.5
|
11
|
+
end
|
20
12
|
|
21
13
|
def compute_bands
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
lt_highs << p0.high_price
|
27
|
-
lt_lows << p0.low_price
|
14
|
+
period_points(micro_period).tap do |period_points|
|
15
|
+
p0.l1 = period_points.map(&:low_price).min
|
16
|
+
p0.h1 = period_points.map(&:high_price).max
|
17
|
+
end
|
28
18
|
|
29
|
-
|
30
|
-
|
19
|
+
period_points(min_period).tap do |period_points|
|
20
|
+
p0.l2 = period_points.map(&:low_price).min
|
21
|
+
p0.h2 = period_points.map(&:high_price).max
|
22
|
+
end
|
31
23
|
|
32
|
-
|
33
|
-
|
24
|
+
period_points(half_period).tap do |period_points|
|
25
|
+
p0.l3 = period_points.map(&:low_price).min
|
26
|
+
p0.h3 = period_points.map(&:high_price).max
|
27
|
+
end
|
34
28
|
|
35
|
-
|
36
|
-
|
29
|
+
period_points(max_period).tap do |period_points|
|
30
|
+
p0.l4 = period_points.map(&:low_price).min
|
31
|
+
p0.h4 = period_points.map(&:high_price).max
|
32
|
+
end
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -4,18 +4,19 @@ module Quant
|
|
4
4
|
class Fibbonacci < Pivot
|
5
5
|
register name: :fibbonacci
|
6
6
|
|
7
|
-
|
8
|
-
half_period
|
9
|
-
end
|
10
|
-
|
11
|
-
def fibbonacci_series
|
12
|
-
[0.146, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.146]
|
13
|
-
end
|
7
|
+
FIBBONACCI_SERIES = [0.146, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.146].freeze
|
14
8
|
|
15
9
|
def compute_bands
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
period_points(adaptive_period).tap do |period_points|
|
11
|
+
highest = period_points.map(&:high_price).max
|
12
|
+
lowest = period_points.map(&:low_price).min
|
13
|
+
p0.range = highest - lowest
|
14
|
+
p0.midpoint = (highest + lowest) * 0.5
|
15
|
+
end
|
16
|
+
|
17
|
+
FIBBONACCI_SERIES.each_with_index do |ratio, index|
|
18
|
+
p0[index + 1] = p0.midpoint + ratio * p0.range
|
19
|
+
p0[-index - 1] = p0.midpoint - ratio * p0.range
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -10,33 +10,24 @@ module Quant
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def scale
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
def alpha
|
17
|
-
bars_to_alpha(min_period)
|
13
|
+
3.0
|
18
14
|
end
|
19
15
|
|
20
16
|
def compute_midpoint
|
17
|
+
alpha = bars_to_alpha(min_period)
|
21
18
|
p0.midpoint = alpha * p0.input + (1 - alpha) * p1.midpoint
|
22
19
|
end
|
23
20
|
|
24
|
-
|
25
|
-
atr_value = atr_point.slow * scale
|
21
|
+
KELTNER_SERIES = [0.236, 0.382, 0.500, 0.618, 0.786, 1.0].freeze
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
p0.h4 = p0.midpoint + 0.618 * atr_value
|
30
|
-
p0.h3 = p0.midpoint + 0.500 * atr_value
|
31
|
-
p0.h2 = p0.midpoint + 0.382 * atr_value
|
32
|
-
p0.h1 = p0.midpoint + 0.236 * atr_value
|
23
|
+
def compute_bands
|
24
|
+
atr_value = atr_point.value * scale
|
33
25
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
p0.l6 = p0.midpoint - 1.000 * atr_value
|
26
|
+
KELTNER_SERIES.each_with_index do |ratio, index|
|
27
|
+
offset = ratio * atr_value
|
28
|
+
p0[index + 1] = p0.midpoint + offset
|
29
|
+
p0[-index - 1] = p0.midpoint - offset
|
30
|
+
end
|
40
31
|
end
|
41
32
|
end
|
42
33
|
end
|
@@ -14,20 +14,13 @@ module Quant
|
|
14
14
|
p0.midpoint = p0.lowest + (p0.input * 4.0)
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
p0.h6 = p0.midpoint + p0.input * 6.0
|
19
|
-
p0.h5 = p0.midpoint + p0.input * 5.0
|
20
|
-
p0.h4 = p0.midpoint + p0.input * 4.0
|
21
|
-
p0.h3 = p0.midpoint + p0.input * 3.0
|
22
|
-
p0.h2 = p0.midpoint + p0.input * 2.0
|
23
|
-
p0.h1 = p0.midpoint + p0.input * 1.0
|
17
|
+
MURREY_SERIES = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0].freeze
|
24
18
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
p0.l6 = p0.midpoint - p0.input * 6.0
|
19
|
+
def compute_bands
|
20
|
+
MURREY_SERIES.each_with_index do |ratio, index|
|
21
|
+
p0[index + 1] = p0.midpoint + p0.input * ratio
|
22
|
+
p0[-index - 1] = p0.midpoint - p0.input * ratio
|
23
|
+
end
|
31
24
|
end
|
32
25
|
end
|
33
26
|
end
|
@@ -2,11 +2,9 @@ module Quant
|
|
2
2
|
module Indicators
|
3
3
|
module Pivots
|
4
4
|
class PivotPoint < IndicatorPoint
|
5
|
-
attribute :high_price
|
6
5
|
attribute :avg_high, default: :high_price
|
7
6
|
attribute :highest, default: :input
|
8
7
|
|
9
|
-
attribute :low_price
|
10
8
|
attribute :avg_low, default: :low_price
|
11
9
|
attribute :lowest, default: :input
|
12
10
|
|
@@ -61,7 +59,7 @@ module Quant
|
|
61
59
|
end
|
62
60
|
|
63
61
|
def period
|
64
|
-
|
62
|
+
adaptive_period
|
65
63
|
end
|
66
64
|
|
67
65
|
def averaging_period
|
@@ -72,6 +70,10 @@ module Quant
|
|
72
70
|
period_points(period).map(&:midpoint)
|
73
71
|
end
|
74
72
|
|
73
|
+
def smoothed_average_midpoint
|
74
|
+
three_pole_super_smooth :input, previous: :midpoint, period: averaging_period
|
75
|
+
end
|
76
|
+
|
75
77
|
def compute
|
76
78
|
compute_extents
|
77
79
|
compute_value
|
@@ -93,14 +95,12 @@ module Quant
|
|
93
95
|
|
94
96
|
def compute_extents
|
95
97
|
period_midpoints.tap do |midpoints|
|
96
|
-
p0.high_price = t0.high_price
|
97
|
-
p0.low_price = t0.low_price
|
98
98
|
p0.highest = midpoints.max
|
99
99
|
p0.lowest = midpoints.min
|
100
100
|
p0.range = p0.high_price - p0.low_price
|
101
|
-
p0.avg_low =
|
102
|
-
p0.avg_high =
|
103
|
-
p0.avg_range =
|
101
|
+
p0.avg_low = three_pole_super_smooth(:low_price, previous: :avg_low, period: averaging_period)
|
102
|
+
p0.avg_high = three_pole_super_smooth(:high_price, previous: :avg_high, period: averaging_period)
|
103
|
+
p0.avg_range = three_pole_super_smooth(:range, previous: :avg_range, period: averaging_period)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
data/lib/quant/version.rb
CHANGED
data/lib/quantitative.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quantitative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Lang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|