I am trying to get the previous values of MACD, HIST and SIGNAL on this formula, it keeps getting this error: TypeError: vHist has no properties. I
t was working fine on the Stochastic study.
Any modification that let this formula work will be appreciated.
Thanx,
Safa
var study = new MACDStudy(12, 26, 9, "C");
function preMain() {
setDefaultBarFgColor(Color.yellow, 0);
setDefaultBarFgColor(Color.lime, 1);
setDefaultBarFgColor(Color.red, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 0 );
setCursorLabelName("Hist", 0);
setCursorLabelName("Sig", 1);
setCursorLabelName("Macd", 2);
addBand(0.0, PLOTTYPE_LINE, 3, Color.blue);
}
function main() {
var vMACD = study.getValue(MACDStudy.MACD, 0,-5 );
var vSignal = study.getValue(MACDStudy.SIGNAL,0,-5);
var vHist = study.getValue(MACDStudy.HIST,-5);
return new Array(vHist[3], vMACD[3], vSignal[3]);
}
t was working fine on the Stochastic study.
Any modification that let this formula work will be appreciated.
Thanx,
Safa
var study = new MACDStudy(12, 26, 9, "C");
function preMain() {
setDefaultBarFgColor(Color.yellow, 0);
setDefaultBarFgColor(Color.lime, 1);
setDefaultBarFgColor(Color.red, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 0 );
setCursorLabelName("Hist", 0);
setCursorLabelName("Sig", 1);
setCursorLabelName("Macd", 2);
addBand(0.0, PLOTTYPE_LINE, 3, Color.blue);
}
function main() {
var vMACD = study.getValue(MACDStudy.MACD, 0,-5 );
var vSignal = study.getValue(MACDStudy.SIGNAL,0,-5);
var vHist = study.getValue(MACDStudy.HIST,-5);
return new Array(vHist[3], vMACD[3], vSignal[3]);
}
Comment