Skip to content

Commit

Permalink
the returned out lists now correspond to what ta-lib returns, i.e. no…
Browse files Browse the repository at this point in the history
… more leading nil values, but trailing nil values.
  • Loading branch information
rivella50 committed Dec 28, 2013
1 parent 836c009 commit 1127731
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ begin
gemspec.homepage = "http://github.com/rivella50/talib-ruby"
gemspec.authors = ["Valentin Treu"]
gemspec.extensions << 'ext/talib/extconf.rb'
gemspec.version = '1.0.5'
gemspec.version = '1.0.6'
gemspec.files = FileList['example/ma.rb','ext/talib/talib.c', 'README.rdoc','lib/**/*.rb']
gemspec.test_files = []
end
Expand Down
10 changes: 5 additions & 5 deletions example/adx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
5.times do |k|

b = Array.new(10)
l = TaLib::Function.new("ADX")
ta = TaLib::Function.new("ADX")
# setup input price
# open = nil, volume = nil, open_interest = nil
l.in_price(0, nil, h, l, c, nil, nil);
ta.in_price(0, nil, h, l, c, nil, nil);
# setup optional parameter
l.opt_int(0,k+2);
ta.opt_int(0,k+2);
# setup output parameter
l.out_real(0,b);
l.call(0,9)
ta.out_real(0,b);
ta.call(0,9)
p "k=#{k+2}"
p b
end
2 changes: 1 addition & 1 deletion ext/talib/talib.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static VALUE ta_func_call(VALUE self, VALUE in_start, VALUE in_end)
for (j=0; j<out_num; j++)
{
double el = ((double*)param_holder->out[i])[j];
rb_ary_store(sub_ary, j+out_start, rb_float_new(el));
rb_ary_store(sub_ary, j, rb_float_new(el));
}
}
return rb_ary_new3(2, INT2FIX(out_start), INT2FIX(out_num));
Expand Down

0 comments on commit 1127731

Please sign in to comment.