I am far from a coding expert but I made an RMO indicator. I am trying to get the long term RMO (constaint D) to show as a bar or column instead of a line. Can anyone help with how I do that.
class RMO {
init() {
this.highest = MovingHigh(this.props.smoothPeriod);
this.lowest = MovingLow(this.props.smoothPeriod);
this.emaa = EMA(this.props.swingTrdLen);
this.emab = EMA(this.props.swingTrdLen);
this.ema1 = EMA(this.props.rmoLength);
this.ema2 = EMA(this.props.rmoLength);
this.ema3 = EMA(this.props.rmoLength);
this.ema4 = EMA(this.props.rmoLength);
this.sma = SMA(this.props.short);
this.sma1 = SMA(this.props.short);
this.sma2 = SMA(this.props.short);
this.sma3 = SMA(this.props.short);
this.sma4 = SMA(this.props.short);
this.sma5 = SMA(this.props.short);
this.sma6 = SMA(this.props.short);
this.sma7 = SMA(this.props.short);
this.sma8 = SMA(this.props.short);
this.sma9 = SMA(this.props.short);
}
map(d) {
const high = d.high();
const low = d.low();
const close = d.close();
const hh = this.highest(high);
const ll = this.lowest(low);
//
const D1 = -100 * (hh - close) / (hh - ll);
const Eighty = -80;
const Twenty = -20;
const Zero = 0;
var smav1 = this.sma(close);
var smav2 = this.sma1(smav1);
var smav3 = this.sma2(smav2);
var smav4 = this.sma3(smav3);
var smav5 = this.sma4(smav4);
var smav6 = this.sma5(smav5);
var smav7 = this.sma6(smav6);
var smav8 = this.sma7(smav7);
var smav9 = this.sma8(smav8);
var smav10 = this.sma9(smav9);
var tester = (smav1 + smav2 +smav3 + smav4 + smav5 + smav6 + smav7 + smav8 + smav9 + smav10) / 10;
const rmoa = 100* (close - tester) / (hh - ll);
const rmob = this.ema1(rmoa);
const rmoc = this.emaa (rmoa);
const rmod = this.emab (rmoc);
const D = rmob;
return { D, rmoc, rmod, Zero};
}
filter(d) {
return predef.filters.isNumber(d.D);
}
}
module.exports = {
name: “RMO”,
title: “RMO with Zero Line”,
description: “RMO with Zero Line”,
calculator: RMO,
params: {
smoothPeriod: predef.paramSpecs.period(10),
swingTrdLen: predef.paramSpecs.period(30),
rmoLength: predef.paramSpecs.period(81),
short: predef.paramSpecs.period(2),
},
validate(obj) {
if (obj.period < 1) {
return meta.error("period", "Period should be a positive number");
}
if (obj.rmoLength < 2) {
return meta.error("smoothPeriod", "Smooth period should be greater than 1");
}
return undefined;
},
inputType: meta.InputType.BARS,
areaChoice: meta.AreaChoice.NEW,
plotter: predef.plotters.D,
plots: {
D: { title: "Long RMO"},
rmoc: { title: "Short RMO"},
rmod: { title: "Medium RMO"},
Zero: { displayOnly: true}
},
tags: [predef.tags.Oscillators],
schemeStyles: {
dark: {
rmoc: predef.styles.plot("#CC33FF"),
D: predef.styles.plot("#FF3300"),
Eighty: predef.styles.plot({ color: "#4facc7", lineStyle: 1}),
Twenty: predef.styles.plot({ color: "#4facc7", lineStyle: 1})
}
}
};