Class: Indicator::AutoGen::AdOsc
- Defined in:
- lib/indicator/auto_gen/ad_osc.rb
Overview
Ta-Lib function mapping class Function: ‘ADOSC’ Description: ‘Chaikin A/D Oscillator’ This file has been autogenerated - Do Not Edit.
Instance Attribute Summary collapse
-
#fast_period ⇒ Object
Fast Period <Integer>.
-
#slow_period ⇒ Object
Slow Period <Integer>.
Attributes inherited from Base
Class Method Summary collapse
-
.arguments ⇒ Object
The list of arguments.
-
.inputs ⇒ Object
The minimum set of inputs required.
-
.outputs ⇒ Object
The outputs generated by this function.
-
.price_input? ⇒ Boolean
Is price data required as an input.
Instance Method Summary collapse
-
#initialize(*args) ⇒ AdOsc
constructor
A new instance of AdOsc.
- #run(*args) ⇒ Object
Methods inherited from Base
Methods included from DataMapper
#default_getter, #default_getter=, #map
Constructor Details
#initialize(*args) ⇒ AdOsc
Returns a new instance of AdOsc.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 11 def initialize(*args) if args.first.is_a? Hash h = args.first @fast_period = h[:fast_period] || 3 @slow_period = h[:slow_period] || 10 else @fast_period = args[0] || 3 @slow_period = args[1] || 10 end @func = TaLib::Function.new("ADOSC") end |
Instance Attribute Details
#fast_period ⇒ Object
Fast Period <Integer>
7 8 9 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 7 def fast_period @fast_period end |
#slow_period ⇒ Object
Slow Period <Integer>
9 10 11 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 9 def slow_period @slow_period end |
Class Method Details
.arguments ⇒ Object
The list of arguments
30 31 32 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 30 def self.arguments [ :fast_period, :slow_period ] end |
.inputs ⇒ Object
The minimum set of inputs required
35 36 37 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 35 def self.inputs [ :high, :low, :close, :volume ] end |
.outputs ⇒ Object
The outputs generated by this function
40 41 42 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 40 def self.outputs [ :out_real ] end |
.price_input? ⇒ Boolean
Is price data required as an input
25 26 27 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 25 def self.price_input? true end |
Instance Method Details
#run(*args) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/indicator/auto_gen/ad_osc.rb', line 44 def run(*args) o, h, l, c, v, len = map_ohlcv(self.class.inputs, *args) @func.in_price(0, o, h, l, c, v, nil) @func.opt_int(0, @fast_period) @func.opt_int(1, @slow_period) out_real = Array.new(len) @func.out_real(0, out_real) @func.call(0, len - 1) out_real end |