Class: Quant::Indicators::Pivots::Guppy
- Defined in:
- lib/quant/indicators/pivots/guppy.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_bands ⇒ Object
The short-term MAs are typically set at 3, 5, 8, 10, 12, and 15 periods.
- #compute_midpoint ⇒ Object
- #guppy_ema(period, band) ⇒ Object
Methods inherited from Pivot
#averaging_period, #band?, #compute, #compute_extents, #compute_value, #period, #period_midpoints, #points_class, #smoothed_average_midpoint
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_bands ⇒ Object
The short-term MAs are typically set at 3, 5, 8, 10, 12, and 15 periods. The longer-term MAs are typically set at 30, 35, 40, 45, 50, and 60.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/quant/indicators/pivots/guppy.rb', line 20 def compute_bands p0[1] = guppy_ema(5, 1) p0[2] = guppy_ema(8, 2) p0[3] = guppy_ema(10, 3) p0[4] = guppy_ema(12, 4) p0[5] = guppy_ema(15, 5) p0[6] = guppy_ema(20, 6) p0[7] = guppy_ema(25, 7) p0[-1] = guppy_ema(30, -1) p0[-2] = guppy_ema(35, -2) p0[-3] = guppy_ema(40, -3) p0[-4] = guppy_ema(45, -4) p0[-5] = guppy_ema(50, -5) p0[-6] = guppy_ema(60, -6) p0[-7] = guppy_ema(120, -7) p0[-8] = guppy_ema(200, -8) end |
#compute_midpoint ⇒ Object
14 15 16 |
# File 'lib/quant/indicators/pivots/guppy.rb', line 14 def compute_midpoint p0.midpoint = guppy_ema(3, 0) end |
#guppy_ema(period, band) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/quant/indicators/pivots/guppy.rb', line 7 def guppy_ema(period, band) return p0.input unless p1[band] alpha = (period) alpha * p0.input + (1 - alpha) * p1[band] end |