Class: NDayEma

Inherits:
Ema
  • Object
show all
Defined in:
lib/rbma/n_day_ema.rb

Instance Attribute Summary

Attributes inherited from Ema

#a, #last

Instance Method Summary collapse

Methods inherited from Ema

#compute, #to_s

Constructor Details

#initialize(n:) ⇒ NDayEma

Returns a new instance of NDayEma.



2
3
4
5
6
7
8
9
# File 'lib/rbma/n_day_ema.rb', line 2

def initialize(n:)
  if n < 2
    warn "ATTENTION: N should probably be bigger thant 2."
  else
    a = 2.0/(n+1)
    super(a: a)
  end
end