Class: Quant::Indicators::Ema
- Defined in:
- lib/quant/indicators/ema.rb
Constant Summary
Constants inherited from Indicator
Constants included from Mixins::UniversalFilters
Instance Attribute Summary
Attributes inherited from Indicator
#p0, #p1, #p2, #p3, #series, #source, #t0, #t1, #t2, #t3
Instance Method Summary collapse
- #compute ⇒ Object
- #compute_emas ⇒ Object
- #compute_oscillators ⇒ Object
- #compute_super_smoothers ⇒ Object
- #half_dc_period ⇒ Object
Methods inherited from Indicator
#<<, #[], #adaptive_half_period, #adaptive_period, dependent_indicator_classes, depends_on, #dominant_cycle, #dominant_cycle_indicator_class, #dominant_cycle_kind, #each, #half_period, #indicator_name, #initialize, #input, #inspect, #max_period, #micro_period, #min_period, #p, #period_points, #pivot_kind, #points_class, #priority, register, #size, #t, #ticks, #values, #warmed_up?
Methods included from Mixins::FisherTransform
#fisher_transform, #inverse_fisher_transform, #relative_fisher_transform
Methods included from Mixins::Stochastic
Methods included from Mixins::SuperSmoother
#three_pole_super_smooth, #two_pole_super_smooth
Methods included from Mixins::HilbertTransform
Methods included from Mixins::ExponentialMovingAverage
Methods included from Mixins::SimpleMovingAverage
Methods included from Mixins::WeightedMovingAverage
#extended_weighted_moving_average, #weighted_moving_average
Methods included from Mixins::UniversalFilters
#universal_band_pass, #universal_ema, #universal_filter, #universal_one_pole_high_pass, #universal_one_pole_low_pass, #universal_two_pole_high_pass, #universal_two_pole_low_pass
Methods included from Mixins::ButterworthFilters
#three_pole_butterworth, #two_pole_butterworth
Methods included from Mixins::HighPassFilters
#high_pass_filter, #hpf2, #two_pole_high_pass_filter
Methods included from Mixins::Functions
#angle, #bars_to_alpha, #deg2rad, #period_to_alpha, #rad2deg
Constructor Details
This class inherits a constructor from Quant::Indicators::Indicator
Instance Method Details
#compute ⇒ Object
60 61 62 63 64 |
# File 'lib/quant/indicators/ema.rb', line 60 def compute compute_super_smoothers compute_emas compute_oscillators end |
#compute_emas ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/quant/indicators/ema.rb', line 42 def compute_emas p0.ema_dc_period = ema :input, previous: :ema_dc_period, period: dc_period p0.ema_half_dc_period = ema :input, previous: :ema_half_dc_period, period: half_dc_period p0.ema_micro_period = ema :input, previous: :ema_micro_period, period: micro_period p0.ema_min_period = ema :input, previous: :ema_min_period, period: min_period p0.ema_half_period = ema :input, previous: :ema_half_period, period: half_period p0.ema_max_period = ema :input, previous: :ema_max_period, period: max_period end |
#compute_oscillators ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/quant/indicators/ema.rb', line 51 def compute_oscillators p0.osc_dc_period = p0.ss_dc_period - p0.ema_dc_period p0.osc_half_dc_period = p0.ss_half_dc_period - p0.ema_half_dc_period p0.osc_micro_period = p0.ss_micro_period - p0.ema_micro_period p0.osc_min_period = p0.ss_min_period - p0.ema_min_period p0.osc_half_period = p0.ss_half_period - p0.ema_half_period p0.osc_max_period = p0.ss_max_period - p0.ema_max_period end |
#compute_super_smoothers ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/quant/indicators/ema.rb', line 33 def compute_super_smoothers p0.ss_dc_period = super_smoother :input, previous: :ss_dc_period, period: dc_period p0.ss_half_dc_period = super_smoother :input, previous: :ss_half_dc_period, period: half_dc_period p0.ss_micro_period = super_smoother :input, previous: :ss_micro_period, period: micro_period p0.ss_min_period = super_smoother :input, previous: :ss_min_period, period: min_period p0.ss_half_period = super_smoother :input, previous: :ss_half_period, period: half_period p0.ss_max_period = super_smoother :input, previous: :ss_max_period, period: max_period end |
#half_dc_period ⇒ Object
29 30 31 |
# File 'lib/quant/indicators/ema.rb', line 29 def half_dc_period dc_period / 2 end |