Announcement

Collapse
No announcement yet.

External EFS example?

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

  • External EFS example?

    I have an efs study I use in an intraday chart, that I want to change the bar BG color in, based on whether the intraday close is > or < the previous intraday close (rising or falling). But the efs is locked, so I can't make the BG color changes within that EFS.

    I think I've seen where EFS2 allows referring to an efs by file name, so I could then define two variables varX(0) and varX(-1) which I could use to define the BG color conditions.

    Does someone know of a link to an existing efs that uses an external efs to create variables as above, that I could use as a template?

    Thanks
    shaeffer

  • #2
    shaeffer
    If you search the forums for efsExternal* you will find many examples of scripts that use this function
    Alex

    Comment


    • #3
      It seemed simple enough to follow some existing formats, but I keep getting a "Formula file not found" error message in the efs below:
      PHP Code:
      function main() {
      var 
      myVar;
      //myVar = efsExternal( "C:/Program Files/eSignal/Formulas/My Formulas/EMA 10 Daily.efs" );   
      myVar efsExternal("EMA 10 Daily.efs"); 

      //return getSeries(myVar);
      return myVar.getValue(0);

      I tried forward and back slashes. I tried full path name and current default path for File>> Open. I tried local and global variables. The file name is correct. I've triple checked the path name. I tried efsInternal and efsExternal (since I'm not clear what external or internal is relative to). Any ideas what I'm doing wrong here?

      Thanks
      shaeffer

      Comment


      • #4
        shaeffer
        The path to the efs needs to start from the Formula Root directory which is by default Formulas.
        In the code enclosed below I show two examples of how to call the ema.efs which is in the Library subfolder of Formulas. You can save the script in any subfolder of Formulas
        Alex

        PHP Code:
        function main() {

        var 
        myVar efsExternal"/Library/ema.efs" );   
        //or you can write it as follows
        //myVar = efsExternal("\\Library\\ema.efs"); 

        return myVar.getValue(0);

        Comment


        • #5
          shaeffer
          For some reason the second example does not display both \\ in the php box
          It should be myVar = efsExternal("\\Library\\ema.efs");
          Alex

          Comment


          • #6
            Originally posted by Alexis C. Montenegro
            The path to the efs needs to start from the Formula Root directory which is by default Formulas.
            Thank you Alex. That did it! If you know the keeper of this link http://kb.esignalcentral.com/display...84&r=0.4575617 perhaps you could suggest that detail gets added?

            I was trying to figure out the difference between efsExternal and efsInternal. Does efsInternal mean 'internal' to the efs where the command is being used, as in reference to a function() that follows function main()? (But I thought there was already a way to call a function() that follows function main(), via variable names?). So then efsExternal would be used to call efs's outside of the subject efs, which I'm guessing is the more commom use?

            Regards
            shaeffer

            Comment


            • #7
              shaeffer
              The link you provided does not appear to be valid. Post the Article # (usually located in the pane to the right of the article).

              Does efsInternal mean 'internal' to the efs where the command is being used, as in reference to a function() that follows function main()?
              That is correct

              (But I thought there was already a way to call a function() that follows function main(), via variable names?).
              Yes there is but efsInternal() offers enhanced functionality such as the ability to create a series object from the return of that function. This means that you can use it as a source for builtin (or custom) studies.

              So then efsExternal would be used to call efs's outside of the subject efs, which I'm guessing is the more commom use?
              That is correct. However it is not necessarily the most commonly used. As a matter of fact you may find that efsInternal() is used more often as it allows working within the same efs
              For more information on these functions run a search for efsInternal() or efsExternal() in the EFS KnowledgeBase. You can also find several detailed examples on how to use them here in the Bulletin Board
              Alex

              Comment


              • #8
                Originally posted by Alexis C. Montenegro
                shaeffer
                The link you provided does not appear to be valid. Post the Article # (usually located in the pane to the right of the article).
                The article # is 2084.

                Thanks Alex for the info re internal/external efs's. This is my first attempt to use either, and your answer provided a good framework of when/how to use each.

                Regards
                shaeffer

                Comment

                Working...
                X