i noticed the following bug:
var ma0 = new MAStudy(period, 0, "Close", mavg_type);
var ma0_value = ma0.getValue(MAStudy.MA);
ma0.getValue(...) initially returns a valid value but then suddenly
starts returning only 'null'.
the full code in my main() is below. when running this code i get the following error msg (no crash reporter comes up as the entire eSignal app is now dead cold).
here is the error msg: dialog title = Microsoft Visual C++ Runtime
Library
Runtime Error
R6025
- pure virtual function call (in winsig.exe)
now here is the code of my main function (i was able to bypass this error by using the built-in ema and wma functions instead of MAStudy):
and that's it. hope this helps.
var ma0 = new MAStudy(period, 0, "Close", mavg_type);
var ma0_value = ma0.getValue(MAStudy.MA);
ma0.getValue(...) initially returns a valid value but then suddenly
starts returning only 'null'.
the full code in my main() is below. when running this code i get the following error msg (no crash reporter comes up as the entire eSignal app is now dead cold).
here is the error msg: dialog title = Microsoft Visual C++ Runtime
Library
Runtime Error
R6025
- pure virtual function call (in winsig.exe)
now here is the code of my main function (i was able to bypass this error by using the built-in ema and wma functions instead of MAStudy):
PHP Code:
function main( period, matype ) {
if ( period == null || period <= 2 ) {
period = 7;
}
var mavg_type;
if ( matype != null ) {
matype.toUpperCase();
switch ( matype ) {
case "EMA":
mavg_type = MAStudy.EXPONENTIAL;
break;
case "WMA":
mavg_type = MAStudy.WEIGHTED;
break;
default:
matype = "EMA";
mavg_type = MAStudy.EXPONENTIAL;
}
}
else {
matype = "EMA";
mavg_type = MAStudy.EXPONENTIAL;
}
var studyTitle = "D" + matype;
setStudyTitle(studyTitle);
setCursorLabelName(studyTitle, 0);
_/*
debugPrintln("period = " + period);
debugPrintln("matype = " + matype);
debugPrintln("mavg_type = " + mavg_type);
debugPrintln("studyTitle = " + studyTitle);
*/
// create the MA studies for our indicator
// and get the values of the MA studies
_/* using MAStudy constructor*/
var ma0 = new MAStudy(period, 0, "Close", mavg_type);
var ma0_value = ma0.getValue(MAStudy.MA);
if (ma0 == null) {
debugPrintln("ma0 == null");
return;
}
else {
if (ma0_value == null) {
debugPrintln("ma0_value = null" );
return;
}
if (ma0_value != null) {
debugPrintln("ma0_value = " + ma0_value);
var ma1 = new MAStudy(period, 0, ma0, MAStudy.MA, mavg_type);
var ma1_value = (2 * ma0_value) - ma1.getValue(MAStudy.MA);
// compute the double MA
debugPrintln("ma1_value = " + ma1_value);
if(ma1_value == null) {
debugPrintln("ma1_value == null");
return;
}
debugPrintln("ma1_value = " + ma1_value);
return ma1_value; // the double moving average
}
}
Comment