Hello Joshua,
They're not that complicated and I don't understand them that thoroughly! I've never really programmed in 'C' but the source code is the place to start looking with TA-Lib as there is not a great deal of documentation otherwise - see http://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/ta-lib/c/src/ta_func/
Look at a function like CDLABANDONEDBABY and you can see:
int startIdx,
int endIdx,
float inOpen[],
float inHigh[],
float inLow[],
float inClose[],
double optInPenetration
which tells me I need to provide Open, High, Low, Close prices in that order. I can ignore Penetration as it is optional. This gives me the line in the algo:
results = talib.CDLABANDONEDBABY(openPrices[context.stock], highPrices[context.stock], \
lowPrices[context.stock], closePrices[context.stock])
The simplest thing now is to print 'results' and see what happens. Mostly it will look like this:
[0 0 0 0 0 0 0 0 0 0 0 0 0]
but occasionally it will look like this:
[ 0 0 0 0 0 0 0 0 0 0 0 0 -100]
which shows the pattern has been found with -100 denoting a 'Bearish Abandoned Baby'.
In this case 'results' has 13 entries because that is the number of bars needed to find it and if using batch_transform to get the data a window of 13 bars would be used. Of these 10 bars are used to determine whether the 11th bar is 'long' or not, and bars 11 -13 are the pattern itself. See this explanation in the source code:
/* Proceed with the calculation for the requested range.
* Must have:
* - first candle: long white (black) real body
* - second candle: doji
* - third candle: black (white) real body that moves well within the first candle's real body
* - upside (downside) gap between the first candle and the doji (the shadows of the two candles don't touch)
* - downside (upside) gap between the doji and the third candle (the shadows of the two candles don't touch)
* The meaning of "doji" and "long" is specified with TA_SetCandleSettings
* The meaning of "moves well within" is specified with optInPenetration and "moves" should mean the real body should
* not be short ("short" is specified with TA_SetCandleSettings) - Greg Morris wants it to be long, someone else want
* it to be relatively long
* outInteger is positive (1 to 100) when it's an abandoned baby bottom or negative (-1 to -100) when it's
* an abandoned baby top; the user should consider that an abandoned baby is significant when it appears in
* an uptrend or downtrend, while this function does not consider the trend
*/
And to confirm the meaning of 'long' we can look at http://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/ta-lib/c/src/ta_common/ta_global.c where we find:
const TA_CandleSetting TA_CandleDefaultSettings[] = {
/* real body is long when it's longer than the average of the 10 previous candles' real body */
{ TA_BodyLong, TA_RangeType_RealBody, 10, 1.0 },
P.