Class: Quant::Indicators::DominantCycles::Homodyne
- Inherits:
-
DominantCycle
- Object
- Indicator
- DominantCycle
- Quant::Indicators::DominantCycles::Homodyne
- Defined in:
- lib/quant/indicators/dominant_cycles/homodyne.rb
Overview
Homodyne means the signal is multiplied by itself. More precisely, we want to multiply the signal of the current bar with the complex value of the signal one bar ago
Constant Summary
Constants inherited from Indicator
Constants included from Mixins::UniversalFilters
Instance Attribute Summary
Attributes inherited from DominantCycle
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_indicator_class, #dominant_cycle_period, #points_class, #priority
Methods inherited from Indicator
#<<, #[], #adaptive_half_period, #adaptive_period, #compute, 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_period ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/quant/indicators/dominant_cycles/homodyne.rb', line 12 def compute_period p0.re = (p0.i2 * p1.i2) + (p0.q2 * p1.q2) p0.im = (p0.i2 * p1.q2) - (p0.q2 * p1.i2) p0.re = (0.2 * p0.re) + (0.8 * p1.re) p0.im = (0.2 * p0.im) + (0.8 * p1.im) p0.inst_period = 360.0 / rad2deg(Math.atan(p0.im / p0.re)) if (p0.im != 0) && (p0.re != 0) constrain_period_magnitude_change p0.mean_period = super_smoother :inst_period, previous: :mean_period, period: max_period p0.period = p0.mean_period.round(0).to_i end |