The TA-Lib Library is widely used by trading software developers requiring to perform technical analysis of financial market data.
If you want to use it within the Matlab environment you will easily find the mex-files (needed to execute commands from the Matlab command line) for Windows PCs.
But I wasn’t able to find, instead the mex files for OS X (Lion) (with extension .mexmaci64), so I ended up to write the required c code.
Here you can download:
The mex files to use TALIB in Matlab(R2010b) with OSLion:
It requires the TA-Lib 0.4.0 installed in order to be called by the mex files:
download the archive: ta-lib-0.4.0-src.tar.gz.
Expand it in a new folder then run a terminal window and navigate to it.
Run the following commands:
Now you should have the library freshly compiled, installed and ready to use.
Expand the mex files you downloaded from here and be sure that
Matlab can see them....
You are now ready to call the TA-Lib functions from Matlab in your OS-Lion.
The C files required to generate mex files with all other versions of OS and Matlab:
To compile the code you first need the TA-Lib installed (follow the instructions above).
Then run the command (one for each function, or use the file):
mex TA_ADX.c -I"../TA_COMMON/" -I"../../include/" -L"../.libs/" -l"ta_lib"
Where you have checked your paths which can be different from mine.
The Matlab prototypes of the TA-Lib Functions:
You are free to use, modify, distribute the code but I invite you to send me suggestions, modifications, improvements.
No problem. Please let me know if you find some other issue.
Please check the comments here:
http://www.mathworks.com/matlabcentral/fileexchange/14151-ta-lib-0-3-0-as-mex . For the given data the results for the EMA and SMA are equivalent; which I've just checked is evidently correct. Perhaps the apparent problems lies in the fact there are two different exponents have been used with the EMA in the past: one has exponent = 2/Period and the other has exponent = 2/(1+Period). I no longer think there's a problem. I'm sorry to have bothered you. Thanks again for your code.
I have checked the TA_EMA output using both TA-Lib and the MexFiles wrapper posted here. They appear to give same results. Richard if you could send your expected results in a working case I can go further to locate where the problem is.
Thank you for your comment. I will check as soon as possible if the error depends on the MEXFUNCTION wrapper I wrote or if there are some other issues in the TA-Lib library. I will post here the answer.
Many thanks for submitting this. Are you aware that the TA_EMA function appears to give incorrect results?
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.