Open femtotrader opened 2 months ago
Maybe we could even have something more general (let's call this a smoother) which could take the following parameters:
whom role is to "smooth" values of an indicator
SOBV will be defined like so (for example)
SOBV = Smoother(OBV, 20, ma_type=MAType.SMA)
and could be used like so
ind = SOBV() # or SOBV(*obv_args, **obv_kwargs)
Smoothing indicators which have several values will need to pass a value extractor
https://github.com/nardew/talipp/pull/147
implements such an idea... but with a slightly different API idea
We have now in this PR
SOBV = IndicatorFactory.get_smoother(OBV, MAType.SMA)
indicator = SOBV(20)
Smoother
and MAFactory
seems to be very close concepts but Smoother
contains an internal indicator whom output values are smoothed while MAFactory
just return a moving average indicator set for a given period.
Hi @femtotrader , first, sorry for not following up on all the discussions you opened. It's very appreciated but currently I cannot allocate time for this project. I will return to them as soon as possible.
Regarding a generic smoother, we can instantiate any MA object directly and pass another indicator into it via indicator chaining like bellow:
sma1 = SMA(3)
sma2 = SMA(3, input_indicator = sma1)
This way you can smooth anything via any MA without need for any new object. Does it fit what you are proposing?
Hi @nardew ,
We all have life outside GH! no problem.
My idea was to create SOBV class from OBV class and a moving average class... without setting period neither instantiating the classes. So we can create appropriate classes and only instantiate them as needed.
Kind regards
https://github.com/nardew/talipp/blob/ed5e0e10c986121b5762d4538649212ec05a9847/talipp/indicators/SOBV.py#L44