Need some help with this. I keep getting this "RangeError: invalid array length" error message when I attempt to plot the data. I will use RSI and Momentum for examples as I get the same Error Message as I get with my self developed Indicators. The RSI and Momentum plots appear to be correct when plotted seperately. But when I try to combine the two values is when I get the error message. Values being 1 for Upward Movement and -1 for downward movement.
Any suggestions?
Any suggestions?
PHP Code:
function preMain() {
setPriceStudy(false);
setStudyTitle("Test");
setCursorLabelName("Test", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM ,0);
setDefaultBarThickness(15,0);
addBand( 0.0, PLOTTYPE_LINE , 3, Color.black, -10 );
}
var test_Dir = null;
function main(Base) {
var vExt_MOM = efsInternal("MOM");
var vDir_MOM = getSeries(vExt_MOM,0);
var vExt_RSI = efsInternal("RSI");
var vDir_RSI = getSeries(vExt_RSI,0);
//--------------THIS LINE APPEARS TO BE THE ISSUE -------------------------------
var test_Dir = vDir_RSI + vDir_MOM;
//--------------------------------------------------------------------------------
debugPrint( "The current test_Dir value is: " + test_Dir + "\n" );
Total_Direction = test_Dir ;
if ( Total_Direction > 0 ) {
setBarFgColor( Color.green, 0 );
}
else {
setBarFgColor( Color.red, 0 );
}
return new Array(Total_Direction);
}
function MOM () {
var MOMDirection;
if ((sma(2,mom(20) )) > (sma(20, mom(20) ) ) ) {
MOMDirection = 1;
}
else {
MOMDirection = -1;
}
return (MOMDirection);
}
function RSI () {
var RSIDirection;
if ((sma(2,rsi(20) )) > (sma(20, rsi(20) ) ) ) {
RSIDirection = 1;
}
else {
RSIDirection = -1;
}
return (RSIDirection);
}
Comment