Announcement

Collapse
No announcement yet.

Using Libraries and efs()

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

  • Using Libraries and efs()

    Having spent an hour going through the help files and bulletin board posts I still can't get a grip on how to use library files. Can someone direct me to some examples of how to use them and how to code them. I assume the idea is that any functions within a library can be called once the library has been loaded inot the efs you are working on - so you could have several standard .efs routines in a library and call the functions as needed.

    I am trying to work out how to use the efs() function - using a simple test code I am obviously barking up the wrong tree. Basically I want to get the vUpper, MA, vLower values from the Keltner efs and return the values into another fomula. For now I just want to get the values out and see them but I can't see how to get the values. I attach the incomplete test code and the efs I am calling. Can someone please help explain this.

    I asume that the efs() function uses the whole code contained within the called efs including the coding before the main() function of the code. So no variables referred to within the called efs need defining in the efs doing the calling I hope. So to get the three values produced by the keltner efs I call the function and should be able to pass through the four parameters - every time I try this I get an error saying one or other parameter is incorrect.

    function main () }
    var vKeltner = new Array();
    vKeltner =efs"(keltner channel (ts2k)",20,0,"Close",1.5);
    //this returns a error in parameter for line 58 of the called code
    return vKeltner;
    }

    if the parameters are omitted one gets a single line plot - how do I get the three values rather than a single value?

    if I use efsInternal instead of efs then I get an error saying vKeltner not defined.

    Help please
    slipperx
    Attached Files
    Last edited by Slipperx; 07-21-2005, 12:30 AM.
    Honesty and Valour - where did they go?

  • #2
    Hi Slipperx,

    Initially, I can see that vKeltner =efs"(keltner channel (ts2k)",20,0,"Close",1.5); has the quotes set up incorrectly. It should be

    vKeltner =efs("keltner channel (ts2k)",20,0,"Close",1.5);

    Further, you are setting up the variable vKeltner as an array. That is not appropriate.

    Please check this thread for more in depth information New EFS2 functions - efs() and efsInternal()

    Comment


    • #3
      A correction to my previous post, you need to include the .efs inside the quotes as well, in addition to including the series index item that you are returning. For example:

      vKeltner =efs("keltner channel (ts2k).efs",0,20,0,"Close",1.5);

      Comment


      • #4
        Hi Slipperx,

        To clarify, the zero I used as series index, in the last post, was to retrieve the first element of the array returned from the referenced efs.

        Just to add one last idea, if you wanted to use the efsExternal command (which is discussed in the link I attached below), you can do this:

        vKeltner =efsExternal("keltner channel (ts2k).efs",20,0,"Close",1.5);

        then:

        var myRet0 = getSeries(vKeltner,0);//1st element
        var myRet1 = getSeries(vKeltner,1);//2nd element
        var myRet2 = getSeries(vKeltner,2);//3rd element

        then to get myRet0 value for 10 bars in the past

        myRet0.getValue(-10)

        Comment

        Working...
        X