# Ta-Lib function mapping class 
# Function: 'MAMA'
# Description: 'MESA Adaptive Moving Average'
# This file has been autogenerated - Do Not Edit.
class Indicator::AutoGen::Mama < Indicator::Base
  # Fast Limit <Double>
  attr_accessor :fast_limit
  # Slow Limit <Double>
  attr_accessor :slow_limit

  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

  # Is price data required as an input
  def self.price_input?
    false
  end

  # The list of arguments
  def self.arguments
    [ :fast_limit, :slow_limit ]
  end

  # The minimum set of inputs required
  def self.inputs
    [ :in_real ]
  end

  # The outputs generated by this function
  def self.outputs
    [ :out_mama, :out_fama ]
  end

  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
end
