I would like to write a study that has a study input option that a user can set through edit studies, to print the study in another window, or on the price chart.
I have written the following code as a test. But it does not place the study in a separate window if the user changes an input option from the default (which includes the study on the price chart).
Can anyone point me in the right direction to have the study print in a separate window based on user input? In my real study that I am writing I have a number of other user inputs for parameter modification that I collect, and a number of global variables. I mention this because I also tried a version that had "reloadEFS" if the user selected to put the study in a separate window... and I could not get it to work either. But in reading the reloadEFS() documentation it mentioned that it leaves all Global variables in their current state.,
Thanks,
Judy
var aParms = new Array();
var binit = false;
function preMain () {
setPriceStudy(true);
setComputeOnClose();
setShowTitleParameters(false);
setCursorLabelName("MA", 0);
aParms[0] = new FunctionParameter("cLineColor", FunctionParameter.Color);
with( aParms[0]) {
setName("Line Color");
setDefault(Color.cyan);
}
aParms[1] = new FunctionParameter("bInOtherWindow", FunctionParameter.BOOLEAN);
with (aParms[1]) {
setName("Sep. Window?");
setDefault(false);
}
}
function main(cLineColor, bInOtherWindow) {
if (binit == false) {
binit = true;
setDefaultBarFgColor(cLineColor, 0);
setDefaultBarStyle(PS_SOLID);
setDefaultBarThickness(1);
if (bInOtherWindow == true) {
setPriceStudy(false);
}
}
return( low(0)-1);
}
I have written the following code as a test. But it does not place the study in a separate window if the user changes an input option from the default (which includes the study on the price chart).
Can anyone point me in the right direction to have the study print in a separate window based on user input? In my real study that I am writing I have a number of other user inputs for parameter modification that I collect, and a number of global variables. I mention this because I also tried a version that had "reloadEFS" if the user selected to put the study in a separate window... and I could not get it to work either. But in reading the reloadEFS() documentation it mentioned that it leaves all Global variables in their current state.,
Thanks,
Judy
var aParms = new Array();
var binit = false;
function preMain () {
setPriceStudy(true);
setComputeOnClose();
setShowTitleParameters(false);
setCursorLabelName("MA", 0);
aParms[0] = new FunctionParameter("cLineColor", FunctionParameter.Color);
with( aParms[0]) {
setName("Line Color");
setDefault(Color.cyan);
}
aParms[1] = new FunctionParameter("bInOtherWindow", FunctionParameter.BOOLEAN);
with (aParms[1]) {
setName("Sep. Window?");
setDefault(false);
}
}
function main(cLineColor, bInOtherWindow) {
if (binit == false) {
binit = true;
setDefaultBarFgColor(cLineColor, 0);
setDefaultBarStyle(PS_SOLID);
setDefaultBarThickness(1);
if (bInOtherWindow == true) {
setPriceStudy(false);
}
}
return( low(0)-1);
}
Comment