Swiss Army Knife Indicator
Swiss Army Knife Indicator (SAKI) was authored by John F. Ehlers. As the name implies the SAKI is many indicators in one. The basic ingredients are current price, previous price, a prior price and feedback. A host of mathematical functions and constants, including pi, sine, cosine, square root and a good portion of the Greek alphabet, are used. The proper ingredients for the calculation of the chosen indicator are applied to a general formula. The user may choose a type from a list of 9 indicators. The user may change the input (midpoint), type, period and a delta1 factor. This indicator’s definition is further expressed in the condensed code given in the calculation below.
How To Trade Using Swiss Army Knife Indicator
No trading signals are calculated for any of these indicators.
How To Access in MotiveWave
Go to the top menu, choose Study>John Ehlers>Swiss Army Knife
or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.
Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.
Calculation
//input = price, user defined, default is midpoint price
//type = indicator, user defined, default is E-SMA
//period = user defined, default is 20
//delta1 = user defined, default is 0.1
//E-EMA = indicator, type of exponential moving average
//E-SMA = indicator, type of simple moving average
//GAUSS = indicator, BUTTER = indicator
//SMOOTH = indicator, HP = indicator
//2PHP = indicator, BP = indicator
//BS = indicator
//index = current bar number
c0 = 1, c1 = 0, b0 = 1, b1 = 0, b2 = 0, a1 = 0; a2 = 0, alpha = 0, beta1 = 0, gamma1 = 0; n = 0; if (type == "E-SMA") n = period; filt = price; prevP1 = price[index-1]; prevP2 = price[index-2]; priorP = price[index-n]; prevFilt1 = ifNull(price, filt[index-1]); //feedback ingredent Filt2 = ifNull(price, filt[index-2]); //feedback ingredent filt = 0; twoPiPrd = (2 * Math.PI)/period; if (type == "E-EMA") alpha = (Math.cos(twoPiPrd) + Math.sin(twoPiPrd) -1) / Math.cos(twoPiPrd); b0 = alpha; a1 = 1 - alpha; endIf if (type == "E-SMA") c1 = 1 / n; b0 = 1 / n; a1 = 1; endIf if (type == "GAUSS") beta1 = 2.451 * (1 - Math.cos(twoPiPrd)); alpha = -beta1 + Math.sqrt(beta1*beta1 + 2*beta1); c0 = alpha * alpha; a1 = 2 * (1 - alpha); a2 = -(1 - alpha) * (1 - alpha); endIf if (type == "BUTTER") beta1 = 2.451 * (1 - Math.cos(twoPiPrd)); alpha = -beta1 + Math.sqrt(beta1*beta1 + 2*beta1); c0 = alpha*alpha / 4; b1 = 2; b2 = 1; a1 = 2 * (1 - alpha); a2 = -(1 - alpha) * (1 - alpha); endif if (type == "SMOOTH") c0 = 1 /4; b1 = 2; b2 = 1; endIf if (type == "HP") alpha = (Math.cos(twoPiPrd) + Math.sin(twoPiPrd) -1) / Math.cos(twoPiPrd); c0 = 1 - alpha / 2; b1 = -1; a1 = 1 - alpha; endIf if (type == "2PHP") beta1 = 2.451 * (1 - Math.cos(twoPiPrd)); alpha = -beta1 + Math.sqrt(beta1 * beta1 + 2 * beta1); c0 = (1 - alpha / 2) * (1 - alpha / 2); b1 = -2; b2 = 1; a1 = 2 * (1 - alpha); a2 = -(1 - alpha) * (1 - alpha); endIf if (type == "BP") beta1 = Math.cos(twoPiPrd); gamma1 = 1 / Math.cos(720 * delta1 / period); alpha = gamma1 + Math.sqrt(gamma1 * gamma1 - 1); c0 = (1 - alpha) / 2; b2 = -1; a1 = beta1 * (1 + alpha); a2 = -alpha; endIf if (type == "BS") beta1 = Math.cos(twoPiPrd); gamma1 = 1 / Math.cos(720 * delta1 / period); alpha = gamma1 - Math.sqrt(gamma1 * gamma1 - 1); c0 = (1 + alpha) / 2; b1 = -2 * beta1; b2 = 1; a1 = beta1 * (1 + alpha); a2 = -alpha; endIf Plot: filt = c0 * ((b0*price) + (b1*prevP1) + (b2*prevP2) + (a1*prevFilt1) + (a2*prevFilt2) - (c1*priorP));