Announcement

Collapse
No announcement yet.

Retrieve Info From All Open Advanced Charts

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

  • #16
    Hi Alexis,

    thanks for the reply, this is great. One more question, is it possible to get the current bar of a 5 min chart from a 1 minute chart, instead of doing the aggregation myself.

    - I think I found the answer to my own question with this from help..

    myVar = open( 0, inv("D") );

    is this the correct approach?

    Thanks again,
    Safwan

    Originally posted by Alexis C. Montenegro
    Safwan
    Yes it is possible. To accomplish that you need to pass to the called efs an interval series using the inv() function.
    For the called efs to be able to run in the context of the interval that is being passed to it the inv() series must be the last parameter being passed. Note that because you are passing a parameter you also need to pass all the other parameters that the study is expecting
    Enclosed below is a revision of the sample script posted earlier in this thread and now set to run the Arps Trender in the context of the 5 minute interval. Besides adding the necessary inv() parameter to the efsExternal() function I have also modified the return statement to return the series rather than the value by using getSeries(). In the charts that follow you can see a comparison of the sample script running on a 1 minute chart and the original Arps Trender script running on a 5 minute chart.
    Alex

    PHP Code:
    function preMain(){
        
    setPriceStudy(true);
        
    setCursorLabelName("Trender");
        
    setPlotType(PLOTTYPE_SQUAREWAVE);
    }
     
    var 
    ExtStudy null;
     
    function 
    main(){
     
        if(
    ExtStudy==nullExtStudy efsExternal("/Advanced/Arps Crown Jewels/Arps Trender.efs"2"true",
                                                  
    Color.blueColor.redColor.white"false""false""false"inv(5));
                                                  
    //added inv(5) as last parameter of efsExternal() function
        
        
    return getSeries(ExtStudy);//modified to return the series for synchronization purpose

    Last edited by SafwanHak; 09-12-2006, 03:31 PM.

    Comment


    • #17
      Safwan
      That is correct. The example you posted will return the value of the Open of the current daily bar.
      Alex

      Comment


      • #18
        Extracting data from series

        Hi Alex,

        I need to review the data before I can return it to the series.

        In this case, I'm using the triple trender, the triple trender has 3 values. I cannot figure out a way to retrieve the 3 values.

        if(ExtStudy==null) ExtStudy = efsExternal("/Advanced/Arps Crown Jewels/Arps Triple Trender.efs");

        var x = getSeries(ExtStudy);
        var y = getSeries(ExtStudy, 1);

        debugPrintln("x : " + x); //Returns one value
        debugPrintln("y : " + y); //Returns null
        debugPrintln("ExtStudy : " + ExtStudy); //Returns one value

        Comment


        • #19
          Safwan
          To retrieve multiple series from an efsExternal() call you use the getSeries() function specifying the series index in the parameters eg
          PHP Code:
          var mySeries efsExternal("path_to_efs, xxx.efs");//this retrieves all the series and can be used to reference
                                                             //the first element of the retrurned array ie seriesIndex 0
          var mySeries1 getSeries(mySeries,1);//this retrieves the series of the second element of the returned array
          var mySeries2 getSeries(mySeries,2);//this retrieves the series of the third element... 
          At this point to retrieve the values you use the .getValue() method on the corresponding series eg
          PHP Code:
          var mySeriesValue_0 mySeries.getValue(0);//current value for mySeries 
          var mySeries1Value_0 mySeries1.getValue(0);//as above but for mySeries1
          var my Series2Value_0 mySeries2.getValue(0);//as above but for mySeries2 
          To retrieve prior values of any one of those series use xyz.getValue(-n) where xyz is the series name and n is the bar index you wish to retrieve eg mySeries1.getValue(-2) will return the value of mySeries1 of two bars back
          Alex

          Comment


          • #20
            Hi Alex,

            Thanks for the quick reply but I seem to have the same problem... I get Null on my second debugPrint.

            PHP Code:
            function preMain(){
                
            setPriceStudy(true);
                
            setCursorLabelName("Trender");
                
            setPlotType(PLOTTYPE_SQUAREWAVE);
            }
             
            var 
            ExtStudy null;
            var 
            mySeries1 null;
            var 
            mySeries2 null;
            function 
            main()
            {

            //I commented out this line so it loads every time but I have the same result
                
            if(ExtStudy==null)
                {
                    
            ExtStudy efsExternal("/Advanced/Arps Crown Jewels/Arps Triple Trender.efs");
                    
            mySeries1 getSeries(ExtStudy,1);//this retrieves the series of the second element of the returned array
                    
            mySeries2 getSeries(ExtStudy,2);//this retrieves the series of the third element...
                
                
            }
                
                
            debugPrintln("ExtStudy[0] : " ExtStudy.getValue(0));      
                
            debugPrintln("ExtStudy[1] : " mySeries1.getValue(0));         
                
                
                return 
            null

            Comment


            • #21
              Safwan
              That is because the second element (as well as the fourth and sixth) of the array returned by the Triple Trender is a string and not a value (see the lables in the Cursor Window of the Triple Trender) hence it will return null.
              The series index parameters you need to use in the getSeries() functions are 0, 2 and 4
              Alex

              Comment


              • #22
                Thank you again. As always great support.

                Just for my own knowledge, what if someone did want the text value that Arps sends out such as the Index 1, 3, 5. What would be the syntax to retrieve those.

                Regards,
                Safwan

                Comment


                • #23
                  Safwan
                  efsInternal() and efsExternal() only retrieve values and not strings.
                  You could use call() or callFunction() however these functions do not create any series.
                  Alex

                  Comment


                  • #24
                    calling an executable via EFS

                    in response to davemabe's question.. it is in fact possible to call an executable using the .dll functionality. What is required is to assign a .dll object to the windows API "shell32.dll" then use the ShellExecuteA command to launch your executable (there is also an example for a URL which loads in the windows default browser insteady of the eSignal browser). Chris D. Kryza wrote an excellent sample script explaining this. I've attached his example for easy reference.

                    Please note, i prefer to eliminate the hard-coded path to the .DLL when calling the windows API since the windows folder may not always be c:\windows. On line 31 I call it simply as:

                    var d=new DLL("shell32.dll");

                    this has always worked fine for me and is more robust.

                    Regarding everything else I think Jason and Alex have done an excellent job describing the ways to integrate our tools into your custom scripts. Their examples can be applied to any of our tools.

                    On a side-note: The triple Trender is just a wrapper for the Arps Trender, which is called 3 times using the examples described in this post. I don't know if it would be any more efficient to simply call the original Trender 3 times in your script rather than calling the triple trender which in turn calls the regular trender. At the very least, it may be easier to manage your code, since the results would be stored separately instead of having to parse them out of a 6 element array.
                    Attached Files

                    Comment

                    Working...
                    X