Announcement

Collapse
No announcement yet.

efsExternal() & efsInternal() return values

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

  • efsExternal() & efsInternal() return values

    Hi,

    As I understand it since the return values from an efsExternal() or efsInternal call are saved to a variable then only one value or series will be returned.

    In other words, if I use efsExternal() (with appropriate parameters) to call an efs that returns, lets say, 3 moving averages; then the efsExternal() call would only retrieve the first moving avg series.

    Is this correct?

    thanks
    Wayne

  • #2
    Hi Wayne,

    Once you create a series object where the series has multiple return values, create a series for each of the return values using the getSeries() command (with appropriate parameters).

    Comment


    • #3
      Thanks Steve,

      Is the syntax you refer to the same as the following sample?

      From thread at http://forum.esignalcentral.com/show...threadid=27514

      main(i1) {

      myStudy = efsInternal ("makinTheOutput",i1);

      var myStudy1 = getSeries(myStudy,0);

      var myStudy2 = getSeries(myStudy,1);



      //now i have an SeriesObject in myStudy1 and myStudy2

      }



      makinTheOutput(i1){

      CurLab = call("outputLessFunc",i1);

      return new Array (CurLab[0], CurLab[1]);

      }


      Thanks

      Wayne

      Comment


      • #4
        Thanks anyway,

        I found my answer in the following post:



        I must have missed it in my first search.

        Wayne

        Comment


        • #5
          waynecd
          FWIW the description of the getSeries() function is provided together with specific examples of its use in this article in the EFS KnowledgeBase
          Alex


          Originally posted by waynecd
          Thanks anyway,

          I found my answer in the following post:



          I must have missed it in my first search.

          Wayne

          Comment


          • #6
            Thank you Alexis.

            Comment


            • #7
              Hi Wayne,

              Sorry for the late reply, I was away.

              I had put together an efs to demonstrate things, but it seems as if your past that.


              Regardless, hope it provides some insight.

              PHP Code:
              /*******************************************
              By Steve Hare © August 2008       
              Use and/or modify this code freely. If you redistribute it
              please include this and/or any other comment blocks and a 
              description of any changes you make.  

              efs created to demonstrate how to obtain multiple series from an 
              efsInternal Series that has multiple return values.
              ********************************************/

              function preMain() {
               
              setPriceStudy(true);
               
              setStudyTitle("efsInternal Example");
               
              //setShowCursorLabel(false); // hides the variables name from the Cursor Window
               
              setShowTitleParameters(false);
               
              setCursorLabelName("high1",0); 
               
              setCursorLabelName("low1",1); 
               
              setCursorLabelName("bar1",2); 
               
              setCursorLabelName("hms1",3); 
               
              setDefaultBarFgColor(Color.blue0);
               
              setDefaultBarFgColor(Color.red1);
               
              setDefaultBarFgColor(Color.blue2);
               
              setDefaultBarFgColor(Color.green3);
               
              setDefaultBarThickness(2,0);
               
              setDefaultBarThickness(2,1);
               
              //~ setIntervalsBackfill(true); 
              }
              debugClear();
              var 
              bInit=false;
              var 
              example1,hms1,high1,low1,close1,raw1,bar1;

              function 
              main() {
               
               if(!
              bInit){
                
              example1=efsInternal("Example",2,inv("10")); // I chose 10 minutes as the external interval, try it on a lesser interval chart
                
              hms1=getSeries(example1,0);
                
              high1=getSeries(example1,1);
                
              low1=getSeries(example1,2);
                
              close1=getSeries(example1,3);
                
              raw1=getSeries(example1,4);
                
              bar1=getSeries(example1,5);
                
              bInit=true;
               }

               
              //~ I return the bar1 seriea and the hms1 series as strings, placing them onto the cursor window and not the chart
               
              return new Array(high1,low1,(bar1.getValue(0)+""),(hms1.getValue(0)+""));
              }

              function 
              Example(n){  // retains constant value
               
              var hms=(hour(0)*100+minute(0))*100+second(0);
               
              //~ note that I am adding the constant to the high and low values of the interval, 
               //~ make sure the constant is commensurate with the price values for proper display
               
              return new Array(hms,(high(0)+n),(low(0)-n),close(0),rawtime(0),getCurrentBarCount());

              Comment


              • #8
                No worries Steve.

                The explanations you add in the efs are very helpful.

                It's a great example and I will add it to my samples archive for future reference.

                Thanks again.

                Comment


                • #9
                  Hi Wayne,

                  Your most welcome.

                  Comment

                  Working...
                  X