Announcement

Collapse
No announcement yet.

Grabbing Mouse Click Data

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

  • #16
    Originally posted by stevehare2003
    Here is one method to accomplish what you requested.

    [/PHP]
    But does it really? Notice MAIN is empty.

    I want to bring back the mouse clicked values back into Main, so I can do operations in my Main efs with these grabbed values.

    If I saw you do something in Main with them, that would address my situation.

    Please provide me some code where you take these mouse values and add, say, 10 to them **doing that in Main.**

    Sure, adding 10 **in the subfunction** is a no-brainer. But how to use values from a function not called in Main -- when Main never called the function -- and then use them in Main?

    Please read my long post of this past weekend where I explain my case. I do not see this code addressing my case.
    Last edited by alexmihh; 02-13-2006, 12:51 PM.

    Comment


    • #17
      I may be missing something important here but wouldn't you simply need to copy the pertinent "click" values into external variables (e.g., variables outside the scope of all functions) and then use that information in main() accordingly, as follows:

      PHP Code:
      var nPriceAtClick        null;
      var 
      nIndexAtClick        null;

      function 
      preMain() {

             
      setPriceStudy(true);
             
      setStudyTitle("Mouse Button Clicks");
             
      setShowCursorLabel(false);

      }
       

      function 
      main() {

       
           if ( 
      nPriceAtClick != null ) {
           
               
      //do something with it
               //then set both back to null
               //to wait for the next click event
           
               
      nPriceAtClick null;
               
      nIndexAtClick null;
               
           }

      }

       
      //== left button click event handler
      function onLButtonDownbarIndexyValue) {

          
      //user left-clicked on the chart. Copy the price and bar-index into
          //our external variables so that this information can now be used in Main()
          //or any other function.
          
      nPriceAtClick yValue;
          
      nIndexAtClick barIndex;



      Chris

      Comment


      • #18
        Here is a copy of the code that makes the variables available in main

        PHP Code:
        var vChartTitle " Double Click Values";
        var 
        uRa = new TenSec(vChartTitle);
        function 
        preMain() 
        {
         
        setPriceStudy(true);
        }
        function 
        main() {
         
        //uRa.aX is the "X" value, 
         //uRa.aY is the "Y" value,
         //that can be accessed in main 

        function 
        onLButtonDblClk(barIndexyValue
        {
         
        uRa.aS(barIndex,yValue);
        }
        function 
        TenSec(ar)
        {
         
         
        this.aR ar;
         
        this.aS = aT;
         
        this.aX null;
         
        this.aY null;
         
        setStudyTitle(ar);
         function 
        aT(x,y){
          
        this.aX=x;
          
        this.aY=y;
          
        setStudyTitle(this.aR+" "+this.aX+", "+this.aY.toFixed(2));
         }

        Comment


        • #19
          Originally posted by stevehare2003
          Here is a copy of the code that makes the variables available in main

          [/PHP]
          Interesting code. It seems that the "trick" is to assign a Global variable to a mouse function. While waiting for your response, over the weekend I was able to accomplish the same thing by saving the mouse values to small files on the hard disk, and in Main reading them when clicking on a button. Much more crude, but it did work.

          Making slight mods to it (multplying by -1 to test it), I have verified it works (see Pic). I would not have figured this out on my own, and I am not sure the EFS docs explained this clearly. If I am correct, I suggest you include such an efs example for users to refer to in the EFS library. Thanks for your help.

          But I found an interesting problem. If I want to format the yValue, at times I was not able to load the formula and would get error message "fff has no properties." I think this is not a major problem because if data is streaming in fast, Main will execute quickly. But at 7 pm CST there is little data flowing in. I had Euro FX futures loaded and sometimes I have to wait a whole minute before any data comes in. And during that time I am not able to load the formula. Once attached succesfully, I can reload it at will, but it seems that initial attachment of the efs to a chart is/can be a problem since the mouse clicked data has no properties (in Main) if you use it in Main before Main executes the first time. Is there a way to fix this?

          var vChartTitle = " Double Click Values";
          var uRa = new TenSec(vChartTitle);

          function preMain() {
          setPriceStudy(true);
          }

          function main() {
          //uRa.aX is the "X" value,
          //uRa.aY is the "Y" value,
          //that can be accessed in main

          var ddd = uRa.aX * -1.0 ;
          var fff = uRa.aY * -1.0 ;

          drawTextRelative(0, 7, " TEST: " + ddd + " and " + fff.toFixed(4), Color.RGB(255,255,0), Color.RGB(0,128,0), Text.RIGHT | Text.RELATIVETOBOTTOM | Text.BOLD, null, 15, "COBTRADE" );
          //drawTextRelative(0, 7, " TEST: " + ddd + " and " + fff, Color.RGB(255,255,0), Color.RGB(0,128,0), Text.RIGHT | Text.RELATIVETOBOTTOM | Text.BOLD, null, 15, "COBTRADE" );

          }

          function onLButtonDblClk(barIndex, yValue) {
          uRa.aS(barIndex,yValue);
          }

          function TenSec(ar){
          this.aR = ar;
          this.aS = aT;
          this.aX = null;
          this.aY = null;
          setStudyTitle(ar);

          function aT(x,y){
          this.aX=x;
          this.aY=y;
          setStudyTitle(this.aR+" "+this.aX+", "+this.aY.toFixed(2));
          }
          }
          Attached Files
          Last edited by alexmihh; 02-13-2006, 07:05 PM.

          Comment


          • #20
            The main ( ) function is used to build individual bars and is called once for each chart bar. Bars are iterated from left to right (from the oldest to the newest bar). While historical data is loaded, the main() function is called once per bar. main() is being called by the efs engine, and is called for each of the historical bars. Once all the history bars are loaded, provided the efs is not running in the computeOnClose() mode, the efs engine calls the main() function every tick. If set for computeOnClose(), main will be called once per bar only.

            So, if you select a point by doubleclicking the chart, the variables associated with the doubleclick function are still set, however, the main function will not run until the efs engine calls it. As you observed, when you reload the chart, all variables are reset to their default values. The only way to get anything to run when there is no trade activity is to take the functionality you want to execute, place it in a seperate function, then call the function from the button click event. If you also want it called when the efs engine executes the main() function, then have the function called from main() as well. Implemented in this manner, you will not have to re-start your efs and create a method to save and retrieve your data.
            Last edited by Guest; 02-14-2006, 10:26 AM.

            Comment


            • #21
              Ok using this code...along with the concept of "mouse grabbing"....is it possible to grab other parts of the chart data?

              For example, by clicking on any one candle, can we grab the Open, Close, High, Low of that individual candle?

              Can these values be saved, and the populated into another part of the code for a different purpose?

              Please let me know.
              Thanks.

              Comment


              • #22
                The answer is yes. The code below is a bit obtuse as I was trying some different JavaScript functionality.

                I revised another efs that should show you how this could work . It is in my fileshare as well as attached below.

                I hope this helps.


                Originally posted by spyder9000
                Ok using this code...along with the concept of "mouse grabbing"....is it possible to grab other parts of the chart data?

                For example, by clicking on any one candle, can we grab the Open, Close, High, Low of that individual candle?

                Can these values be saved, and the populated into another part of the code for a different purpose?

                Please let me know.
                Thanks.
                Attached Files

                Comment


                • #23
                  Whats up Steve,

                  Thanks for your reply.
                  Couple of comments:

                  1.
                  The reason I wanted to know if we can grab all 4 components of any candlestick by just clicking on it (the High, Low, Open, and Close) is because I want to use this information to write a MOUSE CLICK TRADING EFS.

                  Meaning that if an API connection has been established between esignal and the broker, I want to be able to use the extracted information to execute a trade directly on the chart.

                  I have uploaded a screenshot if you don't mind taking a look......

                  I have labeled a trigger candle on the chart (the red candle directly above the words "Trigger Candle.")
                  So by clicking on it, I want to place a BUY STOP order. The stop price is 1 penny above the trigger candles high.
                  The high has been extracted (or "grabbed") by clicking on it.

                  You seem to be very knowledgeable on this subject...you think this is possible to code?
                  It would save an incredible amount of time by skipping the actual order ticket opening, punching in the BUY STOP price, the number of shares, and then hitting the order submit button.

                  2.
                  The other thing is....is it just me, or does anyone else find it odd that there are only 4 or 5 EFS custom programmers listed on Esignals website?
                  I sent a few requests to these guys weeks ago, half never responded, and the others told me to check their file sharing.
                  There has to be more EFS programmers out there right?
                  Can anyone direct me to a list of such individuals?

                  Thanks.

                  Comment


                  • #24
                    whoops....here is the attachment.

                    Comment


                    • #25
                      Did you figure this out??

                      If you do it right, you need to create an array of date for each order placed to the borker, then track each order.

                      This way, using logic, you can place and control each order.

                      The same mouse click functions will allow you to identify locations and bars where clicked or double-clicked. This can control operation of your efs scripts.

                      All of the information you have receive so far it accurate. You need to consider your needs and develop from there.

                      It's not easy, but it can be done in efs.
                      Brad Matheny
                      eSignal Solution Provider since 2000

                      Comment


                      • #26
                        Anyone follow up on this thread?
                        I've been searching the esignal library and noticed that when trying to grab data, Esignal will let you use the "BarHigh" and "BarLow" command.

                        But in other EFS code that are used on here, they reference "H" and "L" as being the candles high and low.

                        Has anyone else used the BarHigh and BarLow commands? If you're using an EFS to conduct click trading (along with Esignals broker integration plugin) wouldn't it make sense to use them?

                        Thanks.

                        Comment


                        • #27
                          Series functions seem to be available from inside the mouse function handlers.

                          For example, close(), open(), etc. can be called inside onLButtonDblClk().

                          See Click Here for simple EFS code illustrating this.

                          Comment

                          Working...
                          X