On Wed, Jan 26, 2011 at 12:32 PM, Michael Orlitzky <mich...@orlitzky.com> wrote: > On 01/26/2011 02:40 PM, Mark Knecht wrote: <SNIP> >> As for testing it _may_ be a slight bit easier than having to get to >> that level. There is a library in portage called ta-lib which >> implements lots of standard technical analysis constructs. After it's >> installed I don't seem to have the C code for the actual functions >> anymore. What I have is a compiled library as well as some header >> files to look at. I suspect I can install the library again using >> portage bt not getting rid of the functions which I could then use as >> an example for my coding. > > Use FEATURES="noclean" and the patched source will be left under > /var/tmp/portage. The unpatched source is probably in your > /usr/portage/distfiles already. (I don't know if there *are* any patches > for ta-lib, but if there are, you usually want them applied). >
Actually, the tar.gz file in distfiles was easily expanded and I found the code within for all the functions. I hadn't considered patches but fortunately there aren't any applied so it seems I get off lucky this time. <SNIP> > > If you can figure out what all those parameters mean -- that will be the > hard part. What type of moving average is EasyLanguage doing? Which > TA_MAType does it match up to? Can the E.L. version fail if it runs off > the end of the prices array, or does it just add zeros at the end? Is > there a way to make TA_MA do the same? > > Sorry I have nothing but discouragement to offer =) This isn't an easy > problem. I don't consider this discouragement at all. In fact it's _very_ helpful. Documentation: I've found this much: Online at the following links: http://ta-lib.org/d_api/d_api.html http://ta-lib.org/function.html I haven't yet found a nice PDF that tells me the exact meaning of every parameter but I suspect it's out there somewhere. There's a forum for the library where people ask questions. I just noticed someone asking about writing documentation to be put in a Wiki so there's something going on. I'm not overly worried about matching up ta-lib functionality with what I use today in EL. Functionality: Software for real-time stock trading tends to be a little more restrictive than more general programming 1) First, we are operating on price data that has date & time attached to every value. Think of a price chart for any stock. This stuff (in general) just operates across time in a forward direction. 2) When doing a moving average, for example, we are calculating from the current bar _backwards_. The only way to run off the end of the array is to try to reference too far back, so a 20 period moving average cannot be calculated before bar #20. As I go through a price data array, I just start at the length parameter into the array N[20] and keep going until the end. The way I see this is there's an upper layer that reads the price data in, puts it in an array and the calls the strategy bar-by-bar. (row-by-row in the array) When it gets to the last bar of data (last row with date and time) then it knows it's done. Pretty much all this stuff seems to work that way. At this point I feel like I've imposed on gentoo-user far too much. I was hoping maybe there was some program in portage for doing translations that might work but I guess there isn't. I'll let this thread drift asleep unless someone responds back. I think I've got enough info to sort of play around at this point, and I suspect my next set of questions are better addressed at someplace like StackOverflow as I can hardly program beyond Hello World at this point! ;-) Again, THANKS for your help and insights! Anyone interested in this subject matter is always welcome to contact me off-list. Cheers, Mark