eSignal Formula Studies -- MACD Slow Study

The JavaScript code for the MACD Slow study is provided as an example of what the code behind a study looks like. Because eSignal stores the formula studies in plain text JavaScript, you can also modify them or create a formula in any text editor.

////////////////////////////////////////////

var study = new MACDStudy(12, 26, 9, "Close", false);

function preMain() {
setDefaultBarFgColor(Color.magenta, 0); // hist
setDefaultBarFgColor(Color.blue, 1); // signal
setDefaultBarFgColor(Color.red, 2); // macd

setPlotType(PLOTTYPE_HISTOGRAM, 0);
}

function main() {
var vMACD = study.getValue(MACDStudy.MACD);
var vSignal = study.getValue(MACDStudy.SIGNAL);
var vHist = study.getValue(MACDStudy.HIST);

return new Array(vHist, vMACD, vSignal);
}

////////////////////////////////////////////

close this window