TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.49k stars 1.74k forks source link

Add "num_candles" data to Pattern Recognition function .info #276

Open TheLetterJ opened 5 years ago

TheLetterJ commented 5 years ago

When retrieving info about a pattern recognition indicator via Function('CDLADVANCEBLOCK').info it would be nice for it to return the number of candles in that pattern so we don't have to keep our own list. For example:

{ 'display_name': 'Advance Block', 'function_flags': ['Output is a candlestick'], 'num_candles': 3, 'group': 'Pattern Recognition', 'input_names': OrderedDict([('prices', ['open', 'high', 'low', 'close'])]), 'name': 'CDLADVANCEBLOCK', 'output_flags': OrderedDict([('integer', ['Line'])]), 'output_names': ['integer'], 'parameters': OrderedDict()}

mrjbq7 commented 5 years ago

Right now the lookback period for the candle functions is not exposed in the info block.

Most (but not all) candle functions have a constant lookback. Some depend on optional "penetration" parameter.

This wouldn't be too hard to add, but it's not exposed (I think) by their TA_GetFuncInfo function.

TheLetterJ commented 5 years ago

I can't seem to find the constant lookback values for the patterns. Where are they in the code or is there a list somewhere?