Class: Indicator::AutoGen::MacdFix
- Defined in:
- lib/indicator/auto_gen/macd_fix.rb
Overview
Ta-Lib function mapping class Function: ‘MACDFIX’ Description: ‘Moving Average Convergence/Divergence Fix 12/26’ This file has been autogenerated - Do Not Edit.
Instance Attribute Summary collapse
-
#signal_period ⇒ Object
Signal 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) ⇒ MacdFix
constructor
A new instance of MacdFix.
- #run(in_real) ⇒ Object
Methods inherited from Base
Methods included from DataMapper
#default_getter, #default_getter=, #map
Constructor Details
#initialize(*args) ⇒ MacdFix
Returns a new instance of MacdFix.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 9 def initialize(*args) if args.first.is_a? Hash h = args.first @signal_period = h[:signal_period] || 9 else @signal_period = args[0] || 9 end @func = TaLib::Function.new("MACDFIX") end |
Instance Attribute Details
#signal_period ⇒ Object
Signal Period <Integer>
7 8 9 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 7 def signal_period @signal_period end |
Class Method Details
.arguments ⇒ Object
The list of arguments
26 27 28 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 26 def self.arguments [ :signal_period ] end |
.inputs ⇒ Object
The minimum set of inputs required
31 32 33 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 31 def self.inputs [ :in_real ] end |
.outputs ⇒ Object
The outputs generated by this function
36 37 38 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 36 def self.outputs [ :out_macd, :out_macd_signal, :out_macd_hist ] end |
.price_input? ⇒ Boolean
Is price data required as an input
21 22 23 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 21 def self.price_input? false end |
Instance Method Details
#run(in_real) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/indicator/auto_gen/macd_fix.rb', line 40 def run(in_real) len = in_real.length @func.in_real(0, map(in_real)) @func.opt_int(0, @signal_period) out_macd = Array.new(len) @func.out_real(0, out_macd) out_macd_signal = Array.new(len) @func.out_real(1, out_macd_signal) out_macd_hist = Array.new(len) @func.out_real(2, out_macd_hist) @func.call(0, len - 1) {:out_macd => out_macd, :out_macd_signal => out_macd_signal, :out_macd_hist => out_macd_hist} end |