Hi,
When the "vComputeOnClose" menu item is set to "true" (which sets up an if statement: if(getBarState()==BARSTATE_NEWBAR){) will the effect be the same as adding a "setComputeOnClose()" statement in the preMain()?
I would like to have a menu item to equate the "setComputeOnClose".
Thank you.
Please see the following example:
var bInit = false;
var aFPArray = new Array();
var vOffset = null;
function preMain() {
setPriceStudy(false);
// setComputeOnClose();
setStudyTitle("Stoch Menu");
setShowTitleParameters(false);
setCursorLabelName("%K",0);
setDefaultBarFgColor(Color.black, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
var x=0;
aFPArray[x] = new FunctionParameter( "vComputeOnClose", FunctionParameter.BOOLEAN);
with( aFPArray[x++] ) {
setName( "Compute On Close" );
setDefault( false );
}
}
var myStudy1 = null;
var myStudy2 = null;
var myVar1;
var myVar1_1;
function main(vComputeOnClose){
if ( bInit == false ) {
myStudy1 = stochK( 10, 5, 3 );
myStudy2 = stochD( 10, 5, 3 );
bInit = true;
}
if(vComputeOnClose){
if(getBarState()==BARSTATE_NEWBAR){
myVar1 = myStudy1.getValue(0);
}
}else{
myVar1 = myStudy1.getValue(0);
}
return myVar1;
}
When the "vComputeOnClose" menu item is set to "true" (which sets up an if statement: if(getBarState()==BARSTATE_NEWBAR){) will the effect be the same as adding a "setComputeOnClose()" statement in the preMain()?
I would like to have a menu item to equate the "setComputeOnClose".
Thank you.
Please see the following example:
var bInit = false;
var aFPArray = new Array();
var vOffset = null;
function preMain() {
setPriceStudy(false);
// setComputeOnClose();
setStudyTitle("Stoch Menu");
setShowTitleParameters(false);
setCursorLabelName("%K",0);
setDefaultBarFgColor(Color.black, 0);
setPlotType(PLOTTYPE_LINE,0);
setDefaultBarThickness(1,0);
var x=0;
aFPArray[x] = new FunctionParameter( "vComputeOnClose", FunctionParameter.BOOLEAN);
with( aFPArray[x++] ) {
setName( "Compute On Close" );
setDefault( false );
}
}
var myStudy1 = null;
var myStudy2 = null;
var myVar1;
var myVar1_1;
function main(vComputeOnClose){
if ( bInit == false ) {
myStudy1 = stochK( 10, 5, 3 );
myStudy2 = stochD( 10, 5, 3 );
bInit = true;
}
if(vComputeOnClose){
if(getBarState()==BARSTATE_NEWBAR){
myVar1 = myStudy1.getValue(0);
}
}else{
myVar1 = myStudy1.getValue(0);
}
return myVar1;
}
Comment