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

  • Retrieve Info From All Open Advanced Charts

    Is there a way to retrieve data from all open advanced charts? I'd like to retrieve a custom data point from each chart and display it in a sortable list.

    Is anything like this possible?

  • #2
    Hello davemabe,

    Yes, this is possible, but not a simple task. What you can do is run a formula on each chart that sends the data to a global scope that makes it available to other formulas using setGlobalValue(). Then you could have another formula running in one of your charts that retrieves this data using getGlobalValue(). To help you identify which chart each data field is from you can embed the charts invoker ID into the name of the global values along with the symbol using getSymbol(). The function used to access this id, getInvokerID(), would be used within the same formula using the setGlobalValue() routine. Your main formula that collects the data could place the values into an array, which can be sorted. To learn more about sorting arrays, please see the core JavaScript reference article on Arrays. Once you have the data sorted you can then display the data using the Drawing Functions such as drawTextPixel() or drawTextRelative().
    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


    • #3
      I have Arps package and I would like to collect information from my 4 charts and aggregate the data into a Buy/Sell signal on one chart (as a confirmation). Can I do this with this SetGlobalValue and GetGlobalValue?


      Originally posted by JasonK
      Hello davemabe,

      Yes, this is possible, but not a simple task. What you can do is run a formula on each chart that sends the data to a global scope that makes it available to other formulas using setGlobalValue(). Then you could have another formula running in one of your charts that retrieves this data using getGlobalValue(). To help you identify which chart each data field is from you can embed the charts invoker ID into the name of the global values along with the symbol using getSymbol(). The function used to access this id, getInvokerID(), would be used within the same formula using the setGlobalValue() routine. Your main formula that collects the data could place the values into an array, which can be sorted. To learn more about sorting arrays, please see the core JavaScript reference article on Arrays. Once you have the data sorted you can then display the data using the Drawing Functions such as drawTextPixel() or drawTextRelative().

      Comment


      • #4
        SafwanHak
        Because the Arps studies are locked you will not be able to add the required setGlobalValue() commands to those scripts.
        However you can call those scripts using the efsExternal() function which allows you to retrieve the values returned by another efs.
        As an example see the script below which calls the Arps Trender study and returns the same value that is returned by that formula (see the enclosed screenshot showing that the plots and values are identical)
        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");
            
        //Note that I am not passing any parameters - if I want to pass any single parameter 
            //I would also need to pass all the other parameters used  by the Trender script
            
            
        return ExtStudy.getValue(0);

        Comment


        • #5
          Thank you Alexis; This is great. I am wondering though about parameters, how would I know what are the required parameters and how would I pass them?

          Safwan

          Originally posted by Alexis C. Montenegro
          SafwanHak
          Because the Arps studies are locked you will not be able to add the required setGlobalValue() commands to those scripts.
          However you can call those scripts using the efsExternal() function which allows you to retrieve the values returned by another efs.
          As an example see the script below which calls the Arps Trender study and returns the same value that is returned by that formula (see the enclosed screenshot showing that the plots and values are identical)
          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");
              
          //Note that I am not passing any parameters - if I want to pass any single parameter 
              //I would also need to pass all the other parameters used  by the Trender script
              
              
          return ExtStudy.getValue(0);

          Comment


          • #6
            Safwan
            You are most welcome.
            Figuring out what the parameters of a study are is relatively easy since all you need to do is apply the study to a chart and then check its parameter list in Edit Studies. Sometimes though it can get tricky understanding how these parameters need to be formatted.
            Using once again the Trender as an example here is the parameter list as it appears when it first loads (or if you click the TDR button on the chart). Note that the same list is also available in Edit Studies.



            From this list we can assume the following;
            The first parameter ie. Sensitivity is almost certainly a number. Use Close? requires true/false which more than likely needs to be formatted as a string because if it were a boolean it would have a checkbox. Then there are three color parameters followed by what appear to be three more true/false strings.
            Once we have this information passing the parameters is easy.
            Let us assume that all we want to do is set the Sensitivity to 4 and set UseClose? to false. In this case the efsExternal() command I used in my prior example needs to be written as follows

            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"4"false",
                                                          
            Color.blueColor.redColor.white"false""false""false");
                
                return 
            ExtStudy.getValue(0);

            Notice that all the true/false parameters are enclosed in quotes thereby making them strings.
            Here is the result of the script compared to the original study. As you can see the values are the same.



            You may want to try to contact Arps' support team and see if they are willing to provide you with the list of the required parameters and their format as this can save you some time.
            Alex

            Comment


            • #7
              This is great.. Thanks.

              Comment


              • #8
                Safwan
                My pleasure
                Alex

                Comment


                • #9
                  Hi again,

                  This is great. however, there is one more thing that would make it perfect. My broker isn't plugged into esignal. Is there a way for me to call an external application (Exe or DLL). In this case the application would be the one that calls the broker to trade based on the signal generated by multiple advanced charts.

                  Is there an easy way? or maybe a way to create my own plugin into esignal?

                  Thanks,
                  Safwan

                  Originally posted by Alexis C. Montenegro
                  Safwan
                  You are most welcome.
                  Figuring out what the parameters of a study are is relatively easy since all you need to do is apply the study to a chart and then check its parameter list in Edit Studies. Sometimes though it can get tricky understanding how these parameters need to be formatted.
                  Using once again the Trender as an example here is the parameter list as it appears when it first loads (or if you click the TDR button on the chart). Note that the same list is also available in Edit Studies.



                  From this list we can assume the following;
                  The first parameter ie.Sensitivity is almost certainly a number. Use Close? requires true/false which more than likely needs to be formatted as a string because if it were a boolean it would have a checkbox. Then there are three color parameters followed by what appear to be three more true/false strings.
                  Once we have this information passing the parameters is easy.
                  Let us assume that all we want to do is set the Sensitivity to 4 and set UseClose? to false. In this case the efsExternal() command I used in my prior example needs to be written as follows

                  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"4"false",
                                                                
                  Color.blueColor.redColor.white"false""false""false");
                      
                      return 
                  ExtStudy.getValue(0);

                  Notice that all the true/false parameters are enclosed in quotes thereby making them strings.
                  Here is the result of the script compared to the original study. As you can see the values are the same.



                  You may want to try to contact Arps' support team and see if they are willing to provide you with the list of the required parameters and their format as this can save you some time.
                  Alex

                  Comment


                  • #10
                    Hello Safwan,

                    It depends on your broker and whether or not they have a method for receiving trades from external applications. Check with the broker to see if they have an API that you can write your custom application to. If they do, then you could create a dll that EFS can connect to using the DLL Object.
                    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


                    • #11
                      Is there anyway to simply call an executable? Just run a local system command is all I want to do.

                      I was thinking it would be really cool to call my local text to speech engine to read the ticker symbol when an alert is fired.

                      Comment


                      • #12
                        Hello davemabe,

                        Other than the DLL Object(), we do not currently have an EFS extension for calling an executable. Feel free to submit a request for this functionality to [email protected].
                        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


                        • #13
                          Hi,

                          Yes. my broker has an API that I already use.. I can turn it into a DLL. With this I should be able to accomplish everything I wanted.. You guys are the best.

                          I'm sure I'll have more questions when I start developing.

                          Thanks,
                          Safwan

                          Originally posted by JasonK
                          Hello Safwan,

                          It depends on your broker and whether or not they have a method for receiving trades from external applications. Check with the broker to see if they have an API that you can write your custom application to. If they do, then you could create a dll that EFS can connect to using the DLL Object.

                          Comment


                          • #14
                            A twist on confirmation

                            Hi,

                            Is it possible to do any of the following?

                            - Be in a 1 minute chart and call Arps on the 5 Minute chart?
                            - Be in a 1 minute chart and read the 5 minute chart price? (instead of doing the work myself again).

                            What I'm trying to do is use the 1 minute, 5 minute price and a cominbination of signals from both intervals, like the Arps trender; the goal is to confirm on both interval and send a final Buy/Sell signal, what would be the best approach to accomplishing such task?

                            Thanks,
                            Safwan

                            Originally posted by Alexis C. Montenegro
                            Safwan
                            You are most welcome.
                            Figuring out what the parameters of a study are is relatively easy since all you need to do is apply the study to a chart and then check its parameter list in Edit Studies. Sometimes though it can get tricky understanding how these parameters need to be formatted.
                            Using once again the Trender as an example here is the parameter list as it appears when it first loads (or if you click the TDR button on the chart). Note that the same list is also available in Edit Studies.



                            From this list we can assume the following;
                            The first parameter ie. Sensitivity is almost certainly a number. Use Close? requires true/false which more than likely needs to be formatted as a string because if it were a boolean it would have a checkbox. Then there are three color parameters followed by what appear to be three more true/false strings.
                            Once we have this information passing the parameters is easy.
                            Let us assume that all we want to do is set the Sensitivity to 4 and set UseClose? to false. In this case the efsExternal() command I used in my prior example needs to be written as follows

                            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"4"false",
                                                                          
                            Color.blueColor.redColor.white"false""false""false");
                                
                                return 
                            ExtStudy.getValue(0);

                            Notice that all the true/false parameters are enclosed in quotes thereby making them strings.
                            Here is the result of the script compared to the original study. As you can see the values are the same.



                            You may want to try to contact Arps' support team and see if they are willing to provide you with the list of the required parameters and their format as this can save you some time.
                            Alex

                            Comment


                            • #15
                              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

                              Comment

                              Working...
                              X