quantitative 0.1.10 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Quant
4
- class Indicators
5
- class MaPoint < IndicatorPoint
6
- attribute :ss, key: "ss"
7
- attribute :ema, key: "ema"
8
- attr_accessor :ss, :ema, :osc
9
-
10
- def initialize_data_points
11
- @ss = input
12
- @ema = input
13
- @osc = nil
14
- end
15
- end
16
-
17
- # Moving Averages
18
- class Ma < Indicator
19
- include Quant::Mixins::Filters
20
-
21
- def alpha(period)
22
- bars_to_alpha(period)
23
- end
24
-
25
- def min_period
26
- 8 # Quant.config.indicators.min_period
27
- end
28
-
29
- def max_period
30
- 48 # Quant.config.indicators.max_period
31
- end
32
-
33
- def compute
34
- # p0.ss = super_smoother input, :ss, min_period
35
- p0.ema = alpha(max_period) * input + (1 - alpha(max_period)) * p1.ema
36
- p0.osc = p0.ss - p0.ema
37
- end
38
- end
39
- end
40
- end