Class: Quant::Indicators::Ma
Overview
Instance Attribute Summary
Attributes inherited from Indicator
#series
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Indicator
#initialize
Class Method Details
.indicator_key ⇒ Object
23
24
25
|
# File 'lib/quant/indicators/ma.rb', line 23
def self.indicator_key
"ma"
end
|
Instance Method Details
#alpha(period) ⇒ Object
27
28
29
|
# File 'lib/quant/indicators/ma.rb', line 27
def alpha(period)
bars_to_alpha(period)
end
|
#compute ⇒ Object
39
40
41
42
43
|
# File 'lib/quant/indicators/ma.rb', line 39
def compute
p0.ss = super_smoother p0.oc2, :ss, min_period
p0.ema = alpha(period) * p0.oc2 + (1 - alpha(period)) * p1.ema
p0.osc = p0.ss - p0.ema
end
|
#min_period ⇒ Object
31
32
33
|
# File 'lib/quant/indicators/ma.rb', line 31
def min_period
settings.min_period
end
|
#period ⇒ Object
35
36
37
|
# File 'lib/quant/indicators/ma.rb', line 35
def period
settings.max_period
end
|