Function Parameter Class

ICE Data Services -

Function Parameter Class


The function parameter class is a set of objects and functions that allow you to manage your input parameters in a script. When this class is used, you will no longer need to initialize parameters passed to your main() function. Here are some example function calls that best describe the usage and functionality of this class:


function preMain() {
  // The order these are defined is not important.

  // Class: FunctionParameter(parameterName, parameterType);

  // What is important is that the "parameterName" matches the parameter in the main definition.

  // Note: setName, setDefault, setLowerLimit, setUpperLimit are all OPTIONAL

  var fp1 = new FunctionParameter("sList", FunctionParameter.STRING); // This is the text that will appear in the "edit studies".  Prior to the FunctionParameter class // The name of the variable always appeard in the edit studies box.






  fp1.addOption("option5"); // Default value to select.  -- See notes in main about defaults.


  var fp2 = new FunctionParameter("bInput", FunctionParameter.BOOLEAN);

  fp2.setName("Bool Input");


  var fp3 = new FunctionParameter("sInput", FunctionParameter.STRING);



  var fp4 = new FunctionParameter("nInput", FunctionParameter.NUMBER);



  var fp5 = new FunctionParameter("colorInput", FunctionParameter.COLOR);

  fp5.setDefault(; // askForInput([title]) the title is optional.  This is the text that appears in the titlebar of the // Input box.  This function will cause an input box to appear when the formula is ADDED to the chart.

  askForInput("testing 123");


function main(sList, bInput, sInput, nInput, colorInput, blankInput) {
  if (getCurrentBarIndex() == 0) {
    // Point of interest:  If the user does not provide input values

    // these variables will AUTOMATICALLY be initialized to the value provided in

    // setDefault (see above in preMain).  This means you no longer need to do the

    // if(var==null) var = nnn;


    debugPrintln("sList: " + sList);

    debugPrintln("bInput: " + bInput);

    debugPrintln("sInput: " + sInput);

    debugPrintln("nInput: " + nInput);

    debugPrintln("colorInput: " + colorInput);

    debugPrintln("blankInput: " + blankInput);