class Signals::MACD

MACD

Public Class Methods

new(short_range = 12, long_range = 26, signal_range = 9, smoothing_coefficient = 0.1) click to toggle source

コンストラクタ

short_range

短期EMAの集計期間

long_range

長期EMAの集計期間

signal_range

シグナルの集計期間

smoothing_coefficient

平滑化係数

Calls superclass method Signals::RangeSignal.new
# File src/jiji/model/agents/builtin_files/signals.rb, line 128
def initialize(short_range = 12, long_range = 26,
  signal_range = 9, smoothing_coefficient = 0.1)
  raise 'illegal arguments.' if short_range > long_range

  super(long_range)
  @short_range = short_range
  @smoothing_coefficient = smoothing_coefficient
  @signal = ExponentialMovingAverage.new(
    signal_range, smoothing_coefficient)
end

Public Instance Methods

restore_state(state) click to toggle source
Calls superclass method
# File src/jiji/model/agents/builtin_files/signals.rb, line 159
def restore_state(state)
  super
  @signal.restore_state(state[:signal_state])
end
state() click to toggle source
Calls superclass method
# File src/jiji/model/agents/builtin_files/signals.rb, line 153
def state
  state = super
  state[:signal_state] = @signal.state
  state
end