Class: Quant::Indicators::Pivot
- Defined in:
- lib/quant/indicators/pivot.rb
Direct Known Subclasses
Quant::Indicators::Pivots::Atr, Quant::Indicators::Pivots::Bollinger, Quant::Indicators::Pivots::Camarilla, Quant::Indicators::Pivots::Classic, Quant::Indicators::Pivots::Demark, Quant::Indicators::Pivots::Donchian, Quant::Indicators::Pivots::Fibbonacci, Quant::Indicators::Pivots::Guppy, Quant::Indicators::Pivots::Keltner, Quant::Indicators::Pivots::Murrey, Quant::Indicators::Pivots::Traditional, Quant::Indicators::Pivots::Woodie
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
- #averaging_period ⇒ Object
- #band?(band) ⇒ Boolean
- #compute ⇒ Object
- #compute_bands ⇒ Object
- #compute_extents ⇒ Object
- #compute_midpoint ⇒ Object
- #compute_value ⇒ Object
- #period ⇒ Object
- #period_midpoints ⇒ Object
- #points_class ⇒ Object
Methods inherited from Indicator
#<<, #[], #dc_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, #priority, #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
#averaging_period ⇒ Object
66 67 68 |
# File 'lib/quant/indicators/pivot.rb', line 66 def averaging_period min_period end |
#band?(band) ⇒ Boolean
58 59 60 |
# File 'lib/quant/indicators/pivot.rb', line 58 def band?(band) p0.key?(band) end |
#compute ⇒ Object
74 75 76 77 78 79 |
# File 'lib/quant/indicators/pivot.rb', line 74 def compute compute_extents compute_value compute_midpoint compute_bands end |
#compute_bands ⇒ Object
89 90 91 |
# File 'lib/quant/indicators/pivot.rb', line 89 def compute_bands # No-op -- override in subclasses end |
#compute_extents ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/quant/indicators/pivot.rb', line 93 def compute_extents period_midpoints.tap do |midpoints| p0.high_price = t0.high_price p0.low_price = t0.low_price p0.highest = midpoints.max p0.lowest = midpoints.min p0.range = p0.high_price - p0.low_price p0.avg_low = super_smoother(:low_price, previous: :avg_low, period: averaging_period) p0.avg_high = super_smoother(:high_price, previous: :avg_high, period: averaging_period) p0.avg_range = super_smoother(:range, previous: :avg_range, period: averaging_period) end end |
#compute_midpoint ⇒ Object
81 82 83 |
# File 'lib/quant/indicators/pivot.rb', line 81 def compute_midpoint p0.midpoint = p0.input end |
#compute_value ⇒ Object
85 86 87 |
# File 'lib/quant/indicators/pivot.rb', line 85 def compute_value # No-op -- override in subclasses end |
#period ⇒ Object
62 63 64 |
# File 'lib/quant/indicators/pivot.rb', line 62 def period dc_period end |
#period_midpoints ⇒ Object
70 71 72 |
# File 'lib/quant/indicators/pivot.rb', line 70 def period_midpoints period_points(period).map(&:midpoint) end |
#points_class ⇒ Object
54 55 56 |
# File 'lib/quant/indicators/pivot.rb', line 54 def points_class Quant::Indicators::PivotPoint end |