TA-Lib/ta-lib-python

SSMA - smoothed simple moving average

Closed this issue · 3 comments

Hello, first of all thank you for your amazing job.

I would like to ask you if do you know how to calculate ssma?

I saw this indicator on iqoption site but I can't found how to calc this.

I found SMA but not SSMA.

could you help me ?

fallowing first link I did this js

// (sum of the close prices of the candles in the period)-(SMA of the candles in the period)+(current price)Period

const ssma = (closes = [], sma, currentPrice, period) => {
	const closesSum = closes.reduce( (accum, curr) => accum + curr );
	const calc = (closesSum - sma + currentPrice) * period;
	return calc;
}

@rrfaria I think you want this?

def smma(self,prices,period):
    sum=0
    last=0
    for i,price in enumerate(prices):
        if(i<period-1):
            sum+=price
            yield 0.0
            continue
        elif(i==period-1):
            sum+=price
            last=sum/period
            yield last
            continue
        else:
            last=(last*(period-1)+price)/period
            yield last