Search
📝

다양한 이동평균 계산식

input : length(20); var : Simple(0),Exponential(0),Weighted(0),GeoMA (0),ii(0),Harmonic(0); var : DEMA(0),TEMA(0),TMA(0),alpha(0),RMA(0); var : zxLag(0),zxEMAData(0),ZLEMA(0),Hull(0); var : Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(0.6667), Slowest(0.0645), AdaptMA(0); var : VWMA(0),SMMA(0); //Sma Simple = ma(close, length); //Ema Exponential = ema(close, length); //Wma Weighted = wma(close, length); //기하이평(Geometric Moving Average) GeoMA = Exp( MA(Log(Close), length) ); //조화이평(Hamonic Moving Average) Harmonic = HarmonicMean(close, length); //Harmonic = 1/(accumN(1/close, length)/length); //Double Exponential Moving Average DEMA = 2 * ema(close, length) - ema(ema(c, length), length); //Triple Exponential Moving Average TEMA = (3 * Ema(close,length)) - (3 * Ema(Ema(close,length),length)) + (Ema(Ema(Ema(close,length),length),length)); //Triangular Moving Average TMA = ma(ma(close, Ceiling(length / 2)), floor(length / 2) + 1); //Relative Moving Average alpha = 1/length; RMA = iff(Isnan(RMA[1]) == true , ma(close, length) , alpha * close + (1 - alpha) * iff(isnan(RMA[1]) == true,0,RMA[1])); //Zero lag exponential moving average zxLag = iff(length / 2 == round(length / 2,0) , length / 2 , (length - 1) / 2); zxEMAData = close + (close - close[zxLag]); ZLEMA = ema(zxEMAData, length); //Hull Moving Average Hull = wma(2 * wma(close, length / 2) - wma(close, length), round(sqrt(length),0)); //AMA(Adaptive Moving Average) Diff = AbsValue(Close - Close[1]); IF Index <= length Then AdaptMA = Close; else { Signal = AbsValue(Close - Close[length]); Noise = accumN(Diff, length); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]); } //VWMA(volume-weighted moving average) VWMA = ma(close * volume, length) / ma(volume, length); //SMMA(Smoothed Moving Average) SMMA = iff(IsNan(SMMA[1]) == true, ma(Close, length) , (SMMA[1] * (length - 1) + close) / length);
JavaScript
복사