Class: Quant::Indicators::DecyclerPoint

Inherits:
IndicatorPoint show all
Defined in:
lib/quant/indicators/decycler.rb

Overview

The decycler oscillator can be useful for determining the transition be- tween uptrends and downtrends by the crossing of the zero line. Alternatively, the changes of slope of the decycler oscillator are easier to identify than the changes in slope of the original decycler. Optimum cutoff periods can easily be found by experimentation.

  1. A decycler filter functions the same as a low-pass filter.

  2. A decycler filter is created by subtracting the output of a high-pass filter from the input, thereby removing the high-frequency components by cancellation.

  3. A decycler filter has very low lag.

  4. A decycler oscillator is created by subtracting the output of a high-pass filter having a shorter cutoff period from the output of another high-pass filter having a longer cutoff period.

  5. A decycler oscillator shows transitions between uptrends and down-trends at the zero crossings.

Instance Attribute Summary collapse

Attributes inherited from IndicatorPoint

#indicator, #tick

Instance Method Summary collapse

Methods inherited from IndicatorPoint

#initialize

Methods included from Attributes

deregister, included, register, registry

Constructor Details

This class inherits a constructor from Quant::Indicators::IndicatorPoint

Instance Attribute Details

#agcObject

Returns the value of attribute agc.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def agc
  @agc
end

#decycleObject

Returns the value of attribute decycle.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def decycle
  @decycle
end

#hp1Object

Returns the value of attribute hp1.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def hp1
  @hp1
end

#hp2Object

Returns the value of attribute hp2.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def hp2
  @hp2
end

#iftObject

Returns the value of attribute ift.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def ift
  @ift
end

#oscObject

Returns the value of attribute osc.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def osc
  @osc
end

#peakObject

Returns the value of attribute peak.



17
18
19
# File 'lib/quant/indicators/decycler.rb', line 17

def peak
  @peak
end

Instance Method Details

#initialize_data_points(indicator:) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/quant/indicators/decycler.rb', line 28

def initialize_data_points(indicator:)
  @decycle = oc2
  @hp1 = 0.0
  @hp2 = 0.0
  @osc = 0.0
  @peak = 0.0
  @agc = 0.0
end

#to_hObject



19
20
21
22
23
24
25
26
# File 'lib/quant/indicators/decycler.rb', line 19

def to_h
  {
    "dc" => decycle,
    "hp1" => hp1,
    "hp2" => hp2,
    "osc" => osc,
  }
end