Class: Indicator::AutoGen::Mama
- Defined in:
- lib/indicator/auto_gen/mama.rb
Overview
Ta-Lib function mapping class Function: ‘MAMA’ Description: ‘MESA Adaptive Moving Average’ This file has been autogenerated - Do Not Edit.
Instance Attribute Summary collapse
-
#fast_limit ⇒ Object
Fast Limit <Double>.
-
#slow_limit ⇒ Object
Slow Limit <Double>.
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) ⇒ Mama
constructor
A new instance of Mama.
- #run(in_real) ⇒ Object
Methods inherited from Base
Methods included from DataMapper
#default_getter, #default_getter=, #map
Constructor Details
#initialize(*args) ⇒ Mama
Returns a new instance of Mama.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/indicator/auto_gen/mama.rb', line 11 def initialize(*args) if args.first.is_a? Hash h = args.first @fast_limit = h[:fast_limit] || 5.000000e-1 @slow_limit = h[:slow_limit] || 5.000000e-2 else @fast_limit = args[0] || 5.000000e-1 @slow_limit = args[1] || 5.000000e-2 end @func = TaLib::Function.new("MAMA") end |
Instance Attribute Details
#fast_limit ⇒ Object
Fast Limit <Double>
7 8 9 |
# File 'lib/indicator/auto_gen/mama.rb', line 7 def fast_limit @fast_limit end |
#slow_limit ⇒ Object
Slow Limit <Double>
9 10 11 |
# File 'lib/indicator/auto_gen/mama.rb', line 9 def slow_limit @slow_limit end |
Class Method Details
.arguments ⇒ Object
The list of arguments
30 31 32 |
# File 'lib/indicator/auto_gen/mama.rb', line 30 def self.arguments [ :fast_limit, :slow_limit ] end |
.inputs ⇒ Object
The minimum set of inputs required
35 36 37 |
# File 'lib/indicator/auto_gen/mama.rb', line 35 def self.inputs [ :in_real ] end |
.outputs ⇒ Object
The outputs generated by this function
40 41 42 |
# File 'lib/indicator/auto_gen/mama.rb', line 40 def self.outputs [ :out_mama, :out_fama ] end |
.price_input? ⇒ Boolean
Is price data required as an input
25 26 27 |
# File 'lib/indicator/auto_gen/mama.rb', line 25 def self.price_input? false end |
Instance Method Details
#run(in_real) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/indicator/auto_gen/mama.rb', line 44 def run(in_real) len = in_real.length @func.in_real(0, map(in_real)) @func.opt_real(0, @fast_limit) @func.opt_real(1, @slow_limit) out_mama = Array.new(len) @func.out_real(0, out_mama) out_fama = Array.new(len) @func.out_real(1, out_fama) @func.call(0, len - 1) {:out_mama => out_mama, :out_fama => out_fama} end |