Closed EmmanuelMougin closed 5 months ago
Hi @EmmanuelMougin , can you write a pseudocode what exactly you have in mind? This is the current implementation of EMA:
mult = 2.0 / (self.period + 1.0)
ema = float(mult * self.input_values[-1] + (1.0 - mult) * self.output_values[-1])
Hi @nardew
Something like this : def init(self, period: int, mult: float = None, input_values: List[float] = None, input_indicator: Indicator = None, input_modifier: InputModifierType = None, input_sampling: SamplingPeriodType = None): if mult is None: mult = 2.0 / (period + 1.0)
mult
represents percentage weight applied to the most recent price and to keep this semantics it must be derived from the period
in the specific way. if you want to change the weight, can't you just adjust period
accordingly?
Having mult
independent of period
changes semantics of the indicator. While I agree that you may have some special idea, I would like to avoid complicating otherwise textbook implementation of EMA.
Ok @nardew , i understand, thank' for your response. I will find an other solution :-)
I mean like there is no need for other solution, just setup period
such that it gives you your desired mult
value. Or have I misunderstood the goal?
no, you've understood correctly, I'm the one who got confused, because all I have to do is change the period, which no longer affects the number of values taken into account for the calculation, only EMA [t-1] is used...
Glad to hear that it works for you! Feel free to reopen if you have further questions.
Hello,
Very nice job, talipp is going to help me a lot. I have a small question about ema. is it possible to let the moving average weighting as a parameter with a default value at 2/(n+1)?
Thank's by advance em-cad.fr