Can someone create the Stochastic Momentum index?

Can any out there create the SMI indicator?

Here is the SMI indicator:

const predef = require(“./tools/predef”);
const meta = require(“./tools/meta”);
const MovingHigh = require(“./tools/MovingHigh”);
const MovingLow = require(“./tools/MovingLow”);
const SMA = require(“./tools/SMA”);
const EMA = require(“./tools/EMA”);

class SMI {
init() {
this.highest = MovingHigh(this.props.kperiod);
this.lowest = MovingLow(this.props.kperiod);
this.ema = EMA(this.props.smoothPeriod);
this.ema1 = EMA(this.props.smoothPeriod);
this.ema2 = EMA(this.props.smoothPeriod);
this.ema3 = EMA(this.props.smoothPeriod);
this.ema4 = EMA(this.props.smoothPeriod);

    this.sma = SMA(this.props.smoothPeriod);
    this.sma2 = SMA(this.props.Slow_K_ema_period);
}

map(d) {
    
// High/lows based on K-perod    
    const high = d.high();
    const low = d.low();
    const close = d.close();
    const hh = this.highest(high);
    const ll = this.lowest(low);
    
    const reldiff = close - ((hh+ll)/2);
    const diff = (hh-ll);
    const avgre = this.ema (reldiff);
    const avgre1 = this.ema1 (avgre);
    const avgdif = this.ema2 (diff);
    const avgdif1 = this.ema3 (avgdif);
    
    const hlimit = 40;
    const llimit = -40;
    const zero = 0;
    
    const m = (hh + ll)/2;
    
    
 //   const SMI = avgdif1 === 0 ? 0 : 100 * avgre1 / (avgdif1/2);
      const SMI = 100 * avgre1 / (avgdif1/2);
    
    const SMIavg = this.ema4 (SMI);
    const K = SMI;
//    const K = (hh - ll) === 0 ? 0 : this.sma2(100 * ((close - m) / (hh - ll)));
//    const D = this.sma(K);
    const D = SMIavg;
    return {
        K,
        D,
        hlimit,
        llimit, 
        zero
    };
}

filter(d) {
    return predef.filters.isNumber(d.D);
}

}

module.exports = {
name: “SMI”,
title: “SMI”,
description: “Stochastic Momentum Index”,
calculator: SMI,
params: {
kperiod: predef.paramSpecs.period(14),
smoothPeriod: predef.paramSpecs.period(3),
Slow_K_sma_period: predef.paramSpecs.period(3),
},
validate(obj) {
if (obj.period < 1) {
return meta.error(“period”, “Period should be a positive number”);
}
if (obj.smoothPeriod < 2) {
return meta.error(“smoothPeriod”, “Smooth period should be greater than 1”);
}
return undefined;
},
inputType: meta.InputType.BARS,
areaChoice: meta.AreaChoice.NEW,
plots: {
K: { title: “Slow %K” },
D: { title: “Slow %D” },
zero: { title: “Zero” },
hlimit: { title: “High” },
llimit: { title: “Low” }
},
tags: [predef.tags.Oscillators],
schemeStyles: {
dark: {
K: predef.styles.plot(“#CC33FF”),
D: predef.styles.plot(“#CC6600”)
}
}
};

yaay thank you very much.

How does one add this to the indicators? TIA.