Announcement

Collapse
No announcement yet.

Calling a function with an array output?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling a function with an array output?

    I have a function with an array output and I want to call a specific item in that array in another function. Could anyone tell me the correct syntax for doing this?

    I can understand how to use call or callFunction to do this when the function has only one output, but not when it has four (as in this case).

  • #2
    Possible Assistance...

    I don't know this for sure, but I would bet it would be something like...

    return[x]

    where x is the integer value of the four returned values. I would assume the list starts with 0 - so that would make it 0~3.

    You can try it and see what happens?? This is how most of the other arrays are handled within EFS.

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hi Brad

      Thanks for the reply. I'm sorry, I didn't explain the problem very well, I'm trying to reference the value from another function, not the same one.

      I have a function called "MLROHLC.efs" (nothing clever, just the moving linear regression of the OHLC) the last line of which is:

      return new Array(MLROpen,MLRHigh,MLRLow,MLRClose);


      If, say, I want to access the first component (MLROpen) in this array from another function/study I assumed the call would be something like:

      call("MLROHLC.efs","MLROpen",20);

      .... but this doesn't work.

      (The "20" refers to the only user input variable (length) in the formula).

      Comment


      • #4
        Use something like this from calling program :

        var study = call("Downloads/MLROHLC.efs",20);
        // DownLoads refers to the directory in which you have the
        // efs file MLROHLC - may be different for you

        if (study == null) {return;}

        var Open = study[0]; // var Open now contains MLROpen

        you are now ready to use the value you wanted .

        Look in EFS settings under tools for the root directory name of where it will begin the search for your formula ....

        Good Luck

        Comment

        Working...
        X