Class: Quant::Indicators::DominantCycles::Differential
- Inherits:
-
DominantCycle
- Object
- Indicator
- DominantCycle
- Quant::Indicators::DominantCycles::Differential
- Defined in:
- lib/quant/indicators/dominant_cycles/differential.rb
Overview
The Dual Differentiator algorithm computes the phase angle from the analytic signal as the arctangent of the ratio of the imaginary component to the real compo- nent. Further, the angular frequency is defined as the rate change of phase. We can use these facts to derive the cycle period.
Constant Summary
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
Methods inherited from DominantCycle
#compute, #compute_input_data_points, #compute_mean_period, #compute_phase, #compute_quadrature_components, #compute_smooth_period, #constrain_period_bars, #constrain_period_magnitude_change, #dominant_cycle_period, #period_points, #points_class
Methods inherited from Indicator
#<<, #[], #compute, #dominant_cycle_kind, #each, #half_period, #indicator_name, #initialize, #input, #inspect, #max_period, #micro_period, #min_period, #p, #pivot_kind, #points_class, #size, #t, #ticks, #values
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_period ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/quant/indicators/dominant_cycles/differential.rb', line 8 def compute_period p0.ddd = (p0.q2 * (p0.i2 - p1.i2)) - (p0.i2 * (p0.q2 - p1.q2)) p0.inst_period = p0.ddd > 0.01 ? 6.2832 * (p0.i2**2 + p0.q2**2) / p0.ddd : 0.0 constrain_period_magnitude_change p0.period = p0.inst_period.round(0).to_i end |