Class: Quant::Indicators::Pivots::Woodie

Inherits:
Pivot show all
Defined in:
lib/quant/indicators/pivots/woodie.rb

Overview

PP = (HIGH + LOW + (TODAY’S OPEN * 2)) / 4

S1 = (2 * PP) - HIGH
S2 = PP - RANGE
S3 = L - 2 * (H - PP) (same as: S1 - RANGE)
S4 = S3 - RANGE

Constant Summary

Constants inherited from Indicator

Indicator::PRIORITIES

Constants included from Mixins::UniversalFilters

Mixins::UniversalFilters::K

Instance Attribute Summary

Attributes inherited from Indicator

#p0, #p1, #p2, #p3, #series, #source, #t0, #t1, #t2, #t3

Instance Method Summary collapse

Methods inherited from Pivot

#averaging_period, #band?, #compute, #compute_extents, #compute_midpoint, #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

#stochastic

Methods included from Mixins::SuperSmoother

#three_pole_super_smooth, #two_pole_super_smooth

Methods included from Mixins::HilbertTransform

#hilbert_transform

Methods included from Mixins::ExponentialMovingAverage

#exponential_moving_average

Methods included from Mixins::SimpleMovingAverage

#simple_moving_average

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_bandsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/quant/indicators/pivots/woodie.rb', line 31

def compute_bands
  Quant.experimental("Woodie appears erratic, is unproven and may be incorrect.")

  #   R1 = (2 * PP) - LOW
  p0.h1 = 2.0 * p0.midpoint - t1.low_price

  #   R2 = PP + RANGE
  p0.h2 = p0.midpoint + p0.range

  #   R3 = H + 2 * (PP - L) (same as: R1 + RANGE)
  p0.h3 = t1.high_price + 2.0 * (p0.midpoint - t1.low_price)

  #   R4 = R3 + RANGE
  p0.h4 = p0.h3 + p0.range

  #   S1 = (2 * PP) - HIGH
  p0.l1 = 2.0 * p0.midpoint - t1.high_price

  #   S2 = PP - RANGE
  p0.l2 = p0.midpoint - p0.range

  #   S3 = L - 2 * (H - PP) (same as: S1 - RANGE)
  p0.l3 = t1.low_price - 2.0 * (t1.high_price - p0.midpoint)

  #   S4 = S3 - RANGE
  p0.l4 = p0.l3 - p0.range
end

#compute_valueObject



27
28
29
# File 'lib/quant/indicators/pivots/woodie.rb', line 27

def compute_value
  p0.input = (t1.high_price + t1.low_price + 2.0 * t0.open_price) / 4.0
end