I'm trying to set a custom lookback period of 3 Candles for CDLHANGINGMAN. Reading the documentation of abstract function I can see that the default Lookback period is 11, using
Function('CDLHANGINGMAN').lookback
I want to change it to 3. How can I do that?
It seems you can't change timeperiod for candle functions. They're depend on default values of candle types. But there is a function in C++ interface to change these defaults: TA_SetCandleSettings()
. And there is a code in Python wrapper of this lib that wraps that function. It's introduced by this commit in 0.4.14. Here is the example on how to call it from python.
Timeperiod for CDLHANGINGMAN is
max( max( max( TA_CANDLEAVGPERIOD(BodyShort), TA_CANDLEAVGPERIOD(ShadowLong) ),
TA_CANDLEAVGPERIOD(ShadowVeryShort) ),
TA_CANDLEAVGPERIOD(Near)
) + 1;
So you need to make sure that avgperiod
for candle types BodyShort, ShadowLong, ShadowVeryShort and Near is <= 2. But as there is no function that changes only avgperiod
and it sets all 3 rangetype, avgperiod, factor
that seems not to be easy to do. The list of current default values for all candle types you can find here.