// Downloaded From https://www.WiseStockTrader.com /* Elastic Volume Weighted Moving Average by Christian B. Fries */ function eVWMA(array, N) { result[0] = array[0]; for (i = 1; i < BarCount; i++) { result[i] = ((N - Volume[i]) * result[i - 1] + Volume[i] * array[i]) / N; } return result; } /* Hull Moving Average */ function HMA(array, period) { return WMA(2 * WMA(array, int(period / 2)) - WMA(array, period), int(sqrt(period))); } /* Kaufmann Adaptive Moving Average */ function KAMA(array, period) { Direction = array - Ref(array, -period); Volatility = Sum(abs(array - Ref(array, -1)), period); Volatility = IIf(Volatility > 0, Volatility, 0.00001); ER = abs(Direction / Volatility); FastSC = 2 / (2 + 1); SlowSC = 2 / (30 + 1); SSC = ER * (FastSC - SlowSC) + SlowSC; Constant = SSC^2; return AMA(array, Constant); } /* Tilson's T3 */ function T3(array, period) { s = 0.84; e1 = EMA(array, period); e2 = EMA(e1, period); e3 = EMA(e2, period); e4 = EMA(e3, period); e5 = EMA(e4, period); e6 = EMA(e5, period); c1 = -s^3; c2 = 3*s^2+3*s^3; c3 = -6*s^2 - 3*s - 3*s^3; c4 = 1 + 3*s + s^3 + 3*s^2; return c1 * e6 + c2 * e5 + c3 * e4 + c4*e3; } /* SMMA - Smoothed Moving Average */ function SMMA(array, period) { SetBarsRequired(1000, 0); fsum = 0; for (i = 0; i < period; i++) { result[i] = Null; fsum += array[i]; } result[period] = fsum / period; for (i = period + 1; i < BarCount; i++) { result[i] = (result[i - 1] * period - result[i - 1] + array[i]) / period; } return result; } /* Sine Weighted Moving Average */ function SWMA(array, period) { SetBarsRequired(1000, 0); PI = 4 * atan(1); k = PI / (period + 1); // denominator den = 0; for (i = 1; i <= period; i++) den += sin(i * k); for (i = 0; i < period - 1; i++) result[i] = Null; for (i = period - 1; i < BarCount; i++) { nom = 0; for (j = 1; j <= period; j++) nom += sin(j * k) * array[i - period + j]; result[i] = nom / den; } return result; } // Triangular Moving Average function TMA(array, period) { if ((period % 2) > 0) { // odd Coef1 = (period + 1) /2; Coef2 = Coef1; } else { // even Coef1 = period / 2 + 1; Coef2 = period / 2; } return MA(MA(array, Coef1), Coef2); } /* Volume Weighted Moving Average */ function VWMA(array, period) { return MA(Volume * array, period) / MA(Volume, period); }