Hi,
I was working on a piece of code to pass a obv() series object to a moving average that causes the eSignal application to crash.
Based on my review of the code it was a user error (me), that caused the problem. I forgot to change the MAStudy() to wma(). I ended up passing a series object created from a obv() object.
Although this is a user error this type of problem should not result in the eSignal application to crash.
The MAStudy() and all such studies should have some sort of internal error handling that should intercept nasty errors like this and should not allow the eSignal application to crash.
Following is the code that results in the eSignal application to crash:
When the crash occurred I did complete the crash report with information regarding this problem.
Please let me know if there is any additional information needed to address this problem.
THANX(MKD).
I was working on a piece of code to pass a obv() series object to a moving average that causes the eSignal application to crash.
Based on my review of the code it was a user error (me), that caused the problem. I forgot to change the MAStudy() to wma(). I ended up passing a series object created from a obv() object.
Although this is a user error this type of problem should not result in the eSignal application to crash.
The MAStudy() and all such studies should have some sort of internal error handling that should intercept nasty errors like this and should not allow the eSignal application to crash.
Following is the code that results in the eSignal application to crash:
PHP Code:
/**************************************************
RE : Mar-02-2008_Code_causes_crash.efs
DATE : Mar-02-2008
DESCRIPTION : The following code segment results in a crash of eSignal.
The code attempts to create an OnBalanceVolume obv() object that
is then passed to a Weighted MAStudy().
I inadvertently used MAStudy() instead of wma().
The parameter list for MAStudy() is as follows:
MAStudy(Length, Offset, PriceSource, [StudyType], MovingAverageType)
The parameter list for wma() is as follows:
wma(nLength [, Series | sym() | inv() ][, nBarIndex ] )
During the course of making a code change I incorrectly used
MAStudy() instead of wma(). It appears that the MAStudy()
encountered a problem while processing the "PriceSource".
The version of eSignal that results in this problem is:
Version : 10.0.1086.932 (12/22/2007)
To recreate the problem open an advanced chart using the symbol
ES #F. Then load the code for this study.
I have confirmed that this code does result in the eSignal
application to crash.
**************************************************/
// Define our Global variables
var soOBV = null; // Series Object
var vOBV = null; // Initialized OBV Series Object
var vOBV_MA = null; // Initialized MA Series Object
function preMain() {
setStudyTitle("OBV Study");
setPriceStudy(false);
setShowTitleParameters(false);
setCursorLabelName("OBV", 0);
setPlotType(PLOTTYPE_LINE, 0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarThickness(1, 0);
setDefaultBarFgColor(Color.red, 0);
var fp1 = new FunctionParameter("MALength", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(5);
var fp2 = new FunctionParameter("MAType", FunctionParameter.STRING);
fp2.setName("MAType");
fp2.addOption("MAStudy.SIMPLE");
fp2.addOption("MAStudy.EXPONENTIAL");
fp2.addOption("MAStudy.WEIGHTED");
fp2.addOption("MAStudy.VOLUMEWEIGHTED");
fp2.setDefault("MAStudy.WEIGHTED");
}
function main(MALength, MAType) {
// Create an instance of our OBV:
if (vOBV == null)
{
vOBV = obv(sym("ES #F"));
soOBV = vOBV.getValue(0);
if (vOBV == null || soOBV == null)
{
return;
}
}
// Create an instance of our OBV moving average:
if (vOBV_MA == null)
{
vOBV_MA = new MAStudy(MALength, 0, soOBV, MAStudy.MA, eval(MAType));
if (vOBV_MA == null)
{
return;
}
}
// Generate a moving average based on our OBV:
var nOBVMA = vOBV_MA.getValue(MAStudy.MA);
return nOBVMA;
}
Please let me know if there is any additional information needed to address this problem.
THANX(MKD).
Comment