Announcement

Collapse
No announcement yet.

those elusive parameters

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

  • those elusive parameters

    Hi,

    I'm trying to call an external efs. Even though it seems to me that I'm passing the write parameters based on what esignal shows on the chart, I still get a null. any ideas?

    ArpsDivergenceMin = efsExternal("/Advanced/Arps Crown Jewels/Arps AutoDivergence Tool.efs"
    ,"CCI", 4, 2.5, "true", "true", Color.aqua, Color.aqua, Color.aqua, Color.aqua, 5, "false");


    even when I tried passing with no parameters, I still get null.

    Thanks in advance.
    Safwan

  • #2
    Hi SafwanHak,

    Try using double forward slashes, "//" versus "/". For example, this is an excerpt that works well for me for creating folders:

    var tmp = getFormulaOutputRoot()+"//"+"shOptimizationFolder";
    var folder = new File(tmp);
    if (!folder.exists()){
    folder.mkDir();
    }

    it also works for files as well. It isn't textbook, but it works reliably for me. Alternatively, you can use the escape character '\' as well which is shown in this link that discusses escape characters which gives some other techniques as well.

    There are several techniques I use here in my fileshare that work (although some are different yet).

    Finally, try this test in your efs:


    PHP Code:
    var tmp "Advanced/Arps Crown Jewels/Arps AutoDivergence Tool.efs"// note I removed first forward slash
    var yourFile = new File(tmp);
    debugPrintln(" yourFile.exists(1st test) = "+yourFile.exists());
    var 
    tmp "Advanced"+"//"+"Arps Crown Jewels"+"//"+"Arps AutoDivergence Tool.efs";
    var 
    yourFile = new File(tmp);
    debugPrintln(" yourFile.exists(2nd test) = "+yourFile.exists()); 
    See if these work, if not, play around with some escape sequences, verify the path, etc, etc. I think you should be able to figure it out

    Comment


    • #3
      Thanks for the reply but that doesn't work. I think there is something wrong with the way I'm passing the parameters to efsExternal. It works on another efs, just this specific one fails.

      Comment


      • #4
        Safwan
        As far as I can see the efsExternal() call you posted is working (see enclosed screenshot and code used). Keep in mind though that the original efs appears to return a value only when it identifies a pivot Buy or Sell which is probably why you are seeing nulls.
        Alex



        PHP Code:
        function preMain(){
            
        setPriceStudy(true);
        }
         
        function 
        main(){
         
            var 
        ArpsDivergenceMin efsExternal("/Advanced/Arps Crown Jewels/Arps AutoDivergence Tool.efs"
            
        "CCI"42.5"true""true"Color.aquaColor.aquaColor.aquaColor.aqua5"false");
         

            return 
        ArpsDivergenceMin.getValue(0);

        Comment


        • #5
          Thanks Alex. The problem is I want to avoid calling the function everytime and would prefer to load it once just like I do with other arps. Here is the code where it fails. You had shown me this approach once with the Arps triple trender at


          http://forum.esignalcentral.com/show...threadid=19373

          PHP Code:
          function preMain(){
              
          setPriceStudy(true);
          }
          var 
          ArpsDivergenceMin null;

          function 
          main(){

              if( 
          ArpsDivergenceMin == null )  
                  
          ArpsDivergenceMin efsExternal("/Advanced/Arps Crown Jewels/Arps AutoDivergence Tool.efs"
                  
          "CCI"42.5"true""true"Color.aquaColor.aquaColor.aquaColor.aqua5"false");
           
              
          debugPrintln("ArpsDivergenceMin: " ArpsDivergenceMin);
              
              return 
          ArpsDivergenceMin.getValue(0);

          Comment


          • #6
            Safwan
            It will work also when you call the efsExternal() function only once. You just need to use the .getValue() method to retrieve the value you require (see enclosed revision of your code and resulting chart with Formula Output Window.
            Alex



            PHP Code:
            function preMain(){
                
            setPriceStudy(true);
            }
            var 
            ArpsDivergenceMin null;

            function 
            main(){

                if( 
            ArpsDivergenceMin == null )  
                    
            ArpsDivergenceMin efsExternal("/Advanced/Arps Crown Jewels/Arps AutoDivergence Tool.efs"
                    
            "CCI"42.5"true""true"Color.aquaColor.aquaColor.aquaColor.aqua5"false");
             
                
            debugPrintln("ArpsDivergenceMin: " ArpsDivergenceMin.getValue(0));//modified to retrieve value
                
                
            return ArpsDivergenceMin.getValue(0);

            Comment


            • #7
              Hi Alex,

              Thanks for the reply; I realize my mistake now.

              Another question regarding efsExternal. In one of the efs add-ons that I'm using, the author draws a circle on the chart with a color;

              efsExternal will only return the series and so I cannot tell what the color is as it's not obvious by the series data. Is there a way to get the color by any other way?

              Thanks
              Safwan

              Comment


              • #8
                Safwan
                You are most welcome.
                As to your question I am not aware of a way to determine the color
                Alex

                Comment


                • #9
                  Hi,

                  how about using call instead of efsExternal, that seems to return everything including the color but I'm wondering if it's not more expensive than efxExternal? how does Call differ from efsExternal?

                  Thanks,
                  Safwan

                  Comment


                  • #10
                    Safwan
                    You could use call() or callFunction() provided that the color is being returned by the script you are calling.
                    Note that neither call() nor callFunction() will create a series object or run the called efs in the context of an external symbol and/or interval like efsExternal() can do.
                    Alex

                    Comment


                    • #11
                      thx Alex.

                      I do believe the color is returned because I can see it affect the price in the cursor window. But I'm concerned about call, is it worse when it comes to performance?

                      it seems that with efsExternal, you can keep a reference for re-use but not with call, does that mean that call is like a new instance and so whatever variables the efs has will get reset every time?

                      Thanks

                      Comment


                      • #12
                        Safwan

                        I do believe the color is returned because I can see it affect the price in the cursor window.
                        That does not necessarily mean that the color is being returned by the efs ie that it is included in the return statement. It could just be set using a setBarFgColor() function

                        But I'm concerned about call, is it worse when it comes to performance?
                        The best thing to do is for you to try it and see what perfomance difference there is (if any).

                        it seems that with efsExternal, you can keep a reference for re-use but not with call, does that mean that call is like a new instance and so whatever variables the efs has will get reset every time?
                        Unlike efsExternal() the call() or callFunction() functions do not create a series object hence they do not maintain historical values
                        Alex

                        Comment

                        Working...
                        X