rivella50 / talib-ruby

Ruby Wrapper for the Technical Analysis Library ta-lib
55 stars 31 forks source link

Update FLT2DBL to handle a nil in_array #2

Closed mlamby closed 13 years ago

mlamby commented 13 years ago

I've added a change to the FLT2DBL function to return 0 when the input in_array is nil. The function will attempt to manipulate the null pointer otherwise.

This change is necessary because when FLT2DBL is called from ta_func_setup_in_price() it is valid for some of the price inputs to be nil. For example the ADX indicator only requires the high, low, and close price inputs to be set.

The TA-Lib abstract interface function TA_SetInputParamPricePtr called by this function handles the case where the non-required inputs are null.

I've also added an example that demonstrates the use of an indicator that takes a combination of arrays and nil as price inputs.

rivella50 commented 13 years ago

Thanks for your work. The change is merged into master and a new Gem version (1.0.4) is available as well.