Class: Indicator::AutoGen::UltOsc
- Defined in:
- lib/indicator/auto_gen/ult_osc.rb
Overview
Ta-Lib function mapping class Function: ‘ULTOSC’ Description: ‘Ultimate Oscillator’ This file has been autogenerated - Do Not Edit.
Instance Attribute Summary collapse
-
#first_period ⇒ Object
First Period <Integer>.
-
#second_period ⇒ Object
Second Period <Integer>.
-
#third_period ⇒ Object
Third 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) ⇒ UltOsc
constructor
A new instance of UltOsc.
- #run(*args) ⇒ Object
Methods inherited from Base
Methods included from DataMapper
#default_getter, #default_getter=, #map
Constructor Details
#initialize(*args) ⇒ UltOsc
Returns a new instance of UltOsc.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 13 def initialize(*args) if args.first.is_a? Hash h = args.first @first_period = h[:first_period] || 7 @second_period = h[:second_period] || 14 @third_period = h[:third_period] || 28 else @first_period = args[0] || 7 @second_period = args[1] || 14 @third_period = args[2] || 28 end @func = TaLib::Function.new("ULTOSC") end |
Instance Attribute Details
#first_period ⇒ Object
First Period <Integer>
7 8 9 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 7 def first_period @first_period end |
#second_period ⇒ Object
Second Period <Integer>
9 10 11 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 9 def second_period @second_period end |
#third_period ⇒ Object
Third Period <Integer>
11 12 13 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 11 def third_period @third_period end |
Class Method Details
.arguments ⇒ Object
The list of arguments
34 35 36 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 34 def self.arguments [ :first_period, :second_period, :third_period ] end |
.inputs ⇒ Object
The minimum set of inputs required
39 40 41 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 39 def self.inputs [ :high, :low, :close ] end |
.outputs ⇒ Object
The outputs generated by this function
44 45 46 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 44 def self.outputs [ :out_real ] end |
.price_input? ⇒ Boolean
Is price data required as an input
29 30 31 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 29 def self.price_input? true end |
Instance Method Details
#run(*args) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/indicator/auto_gen/ult_osc.rb', line 48 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, @first_period) @func.opt_int(1, @second_period) @func.opt_int(2, @third_period) out_real = Array.new(len) @func.out_real(0, out_real) @func.call(0, len - 1) out_real end |