Class: Quant::Indicators::Pivots::Keltner
- Defined in:
- lib/quant/indicators/pivots/keltner.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
- #alpha ⇒ Object
- #atr_point ⇒ Object
- #compute_bands ⇒ Object
- #compute_midpoint ⇒ Object
- #scale ⇒ Object
Methods inherited from Pivot
#averaging_period, #band?, #compute, #compute_extents, #compute_value, #period, #period_midpoints, #points_class
Methods inherited from Indicator
#<<, #[], #compute, #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, #points_class, #priority, register, #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
#alpha ⇒ Object
16 17 18 |
# File 'lib/quant/indicators/pivots/keltner.rb', line 16 def alpha (min_period) end |
#atr_point ⇒ Object
8 9 10 |
# File 'lib/quant/indicators/pivots/keltner.rb', line 8 def atr_point series.indicators[source].atr.points[t0] end |
#compute_bands ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/quant/indicators/pivots/keltner.rb', line 24 def compute_bands atr_value = atr_point.slow * scale p0.h6 = p0.midpoint + 1.000 * atr_value p0.h5 = p0.midpoint + 0.786 * atr_value p0.h4 = p0.midpoint + 0.618 * atr_value p0.h3 = p0.midpoint + 0.500 * atr_value p0.h2 = p0.midpoint + 0.382 * atr_value p0.h1 = p0.midpoint + 0.236 * atr_value p0.l1 = p0.midpoint - 0.236 * atr_value p0.l2 = p0.midpoint - 0.382 * atr_value p0.l3 = p0.midpoint - 0.500 * atr_value p0.l4 = p0.midpoint - 0.618 * atr_value p0.l5 = p0.midpoint - 0.786 * atr_value p0.l6 = p0.midpoint - 1.000 * atr_value end |
#compute_midpoint ⇒ Object
20 21 22 |
# File 'lib/quant/indicators/pivots/keltner.rb', line 20 def compute_midpoint p0.midpoint = alpha * p0.input + (1 - alpha) * p1.midpoint end |
#scale ⇒ Object
12 13 14 |
# File 'lib/quant/indicators/pivots/keltner.rb', line 12 def scale 5.0 end |