Announcement

Collapse
No announcement yet.

what is Object Series ?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • what is Object Series ?

    in trying to get to grips with the EFS2 i am noticing that some of the returns are different to the original EFS, a example is below where i was trying to test the return values for different symbols in different time frames, in trying to fault find with the use of debugPrintln i have noticed that i keep getting returns of [Object Series], is this normal .


    PHP Code:
    var test 12;
    var 
    aa null;
    var 
    axp null;
    var 
    ba null;
    var 
    null;
    var 
    cat null;
    var 
    dd null;

    function 
    main(){
    debugPrintln(test," test = ");


    aa close("aa");
    axp close("axp");
    ba close("ba");
    //c = close(-1,"cat",5);
    //cat = close(-1,"cat",60);
    //dd = close(-1,"dd",D);

    debugPrintln(test," test2 = ");
    debugPrintln(aa," aa = ",axp," axp = ",ba," ba = "getSeries(aa));



    return 
    aa;
    //return getSeries(aa);


  • #2
    shogun
    While waiting for a reply to your question from Dion you may want to see the comments I added to your sample script
    Alex


    PHP Code:
    var test 12;
    var 
    aa null;
    var 
    axp null;
    var 
    ba null;
    var 
    null;
    var 
    cat null;
    var 
    dd null;

    function 
    main(){
    debugPrintln(test," test = ");

    //aa = close("aa"); this is EFS1 syntax
    aa close(sym("aa"));//this creates a series in EFS2 syntax
    //aa = close(0,sym("aa"));//this retrieves a single value
    //if you create a series then you can retrieve the single value 
    //in the following way
    //var a0 = aa.getValue(0); or (-1) for the prior bar etc
    axp close(sym("axp"));
    ba close(sym("ba"));
    //c = close(-1,sym("cat,5"));
    //cat = close(-1,sym("cat,60"));
    //dd = close(-1,sym("dd,D"));

    //dd = close(-1,inv("d"));//this retrieves the value at the specified interval

    debugPrintln(test," test2 = ");
    debugPrintln(aa," aa = ",axp," axp = ",ba," ba = "getSeries(aa));


    return 
    aa;
    //return getSeries(aa);

    Comment


    • #3
      i think i have solved the problem ,it seems it was the use of close("aa"); it should have been close(0,sym("aa")); also i was getting a fault with the use of getSeries(aa) in the debugPrintln.


      PHP Code:
      var test 12;
      var 
      aa null;
      var 
      axp null;
      var 
      ba null;
      var 
      null;
      var 
      cat null;
      var 
      dd null;

      function 
      main(){


      if(
      getCurrentBarIndex()>200)return;


      aa close(0,sym("aa"));
      axp close(0,sym("axp"));
      ba close(0,sym("ba"));

      close(-1,"cat,5");
      cat close(-1,"cat,60");
      dd close(-1,"dd,D");

      debugPrintln(test," test2 = ");
      debugPrintln(aa.toFixed(2)," aa = ",axp.toFixed(2)," axp = ",ba.toFixed(2)," ba = ");

      debugPrintln(c.toFixed(2)," c = ",cat.toFixed(2)," cat = ",dd.toFixed(2)," dd = ");

      return 
      aa;


      Comment


      • #4
        thanks alexis for your reply ,

        Comment


        • #5
          i would also use:

          close(-1, sym("cat,5"))

          instead of

          close(-1, "cat,5")

          Comment


          • #6
            Does EFS2 allow more than 5 symbols (the limit in EFS1) to be accessed in a script?

            Comment


            • #7
              z11
              The limit in EFS1 is actually 7 and that is unchanged in EFS2 as far as I have seen.
              Alex

              Comment


              • #8
                What if the indicator is calculated by a DLL? Can one create a series object when the indicator is calculated by a DLL? Or is series object just limited to EFS2 internal indicators?

                Comment


                • #9
                  You can create Series objects by using the efsInternal() and efs() calls, which can then be used by any bulitin study or other Series objects created by other users.

                  Within efsInternal() and efs() you can write this new Series object in EFS code, or you can call down to a DLL to do your processing.

                  So short answer, yes =).

                  Comment


                  • #10
                    Ok, than is good to know.

                    Right now I have no idea how to do that to a DLL. My big problem right now, I do not understand the difference between esfInternal() and efs(). Under what conditions does one use an esfInternal() and what conditions(situations) would one use efs().

                    Comment


                    • #11
                      Hello scjohn,

                      If you want to create a series using a return value from another EFS file, you use efs().

                      efs( pathToEFS, [seriesIndex], [sym/inv], [parameters])

                      When you want to create a series using a function you have created within (internal) your formula, you use efsInternal().

                      efsInternal( functionName, [parameters... ])
                      Jason K.
                      Project Manager
                      eSignal - an Interactive Data company

                      EFS KnowledgeBase
                      JavaScript for EFS Video Series
                      EFS Beginner Tutorial Series
                      EFS Glossary
                      Custom EFS Development Policy

                      New User Orientation

                      Comment


                      • #12
                        After reviewing the EFS2 documentation, it would appear that the best way to approach this would be take the "guts" of the code (in EFS1) involved in handling the DLL and placing this code in an EFS2 efsLib. That way, the DLL looks just like any other function.

                        Comment


                        • #13
                          Yep, that's the idea (and power of EFS2). Also check out some of the tb*.XML files in the 'keywords' folder. If you stick an .XML file with the same name as your .efsLib in the 'FunctionLibrary' folder, you can use the EFS2 Toolbox to insert your custom Series/functions/whatever into the Formula Editor (Toolbox accessible using the red 'T' in the toolbar).

                          Comment

                          Working...
                          X