We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/FajarArrizki/mcp-technical-analysis'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
/**
* Smoothed Moving Average (SMMA) Indicator
* Moving average with different smoothing method than EMA
*/
import { calculateSMA } from './moving-averages'
export function calculateSMMA(closes: number[], period: number = 14): number[] {
if (closes.length < period) return []
const smma: number[] = []
// First SMMA value is SMA
const firstSMA = calculateSMA(closes.slice(0, period), period)
if (firstSMA.length > 0) {
smma.push(firstSMA[0])
}
// Subsequent SMMA values: SMMA = (SMMA_prev * (period - 1) + close_current) / period
for (let i = period; i < closes.length; i++) {
const prevSMMA = smma[smma.length - 1]
const currentClose = closes[i]
const currentSMMA = (prevSMMA * (period - 1) + currentClose) / period
smma.push(currentSMMA)
}
return smma
}