Announcement

Collapse
No announcement yet.

Detection by EFS of lines drawn by user

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

  • Detection by EFS of lines drawn by user

    Does anybody out there know of a way to detect from an EFS, lines drawn on a chart (e.g. drawn by the lines toolbar)? This would be used to detect, say, price violation (crossing) of that line. If the endpoints of a user-drawn line were available, that would be good too. Any ideas?

  • #2
    You can tell this with the Mouse Functions as decribed in Chris' help files

    Mouse Functions



    The mouse functions allow EFS scripts to detect the bar index and Y-axis value of a mouse click on an Advanced chart. To enable the onLButtonDown or onLButtonDblClk mouse click functions add one of the following to an EFS formula. However, if both functions are used within the same EFS, beware that the onLButtonDown function will be called on the first click of the onLButtonDblClk event.

    Comment


    • #3
      Be aware too, that this will only work for lines yet to be drawn, there is no methods currently available to query for existing lines.

      Garth
      Garth

      Comment


      • #4
        Guys, thanks for taking the time to reply to my original post. Unfortunately, what I want to do is not really addressed. My idea is to have the user of the chart use the eSignal toolbar line drawing functions to draw lines on the chart. I then want to 'detect' any/all lines, in otherwords, detect a 'collision' between the price graphing and a line. The analogy, in the video game world, would be say, in a simple pong game, when the moving ball contacts the paddle. I have given this a lot of thought and one way to do what I want is to give the user the ability to draw lines with my EFS code handling the mouse clicks, determining endpoints and using the drawline() functions. I really don't want to have to write a handler for drawing lines (to make it easy for a user to actually use). I was hoping that there was some 'trick' in eSignal to view the parameters (e.g. startpt1x, startpt1y, endpt1x, endpt1y) in a table that eSignal must have somewhere. If not, I'll have to write a handler myself, but ONLY if necessary. I know it would be a good amount of work. I am already quite familiar with the mouse click events and how to use them.

        Comment


        • #5
          Jakester,

          As stated previously there is no way to retroactively get the linetool info. This means to do what you want you will need to write a mouse click handler.

          You can do it such that you draw the line with your efs code, or I believe you can do it as David suggested and just allow the line tools to do their thing and you calc off of the values.

          Garth
          Garth

          Comment


          • #6
            jake....

            You could do it using the MOUSE functions within esignal to allow the users to select starting and ending points for a line (of course you could extend the line automatically with math functions). Next, because you are extending the lines (as many as you wish using arrays), you coudl then test for a price breach of these levels.

            This is the only way that I know of to allow you to accomplish what you want - you have to build everything yourself.

            Let me know if this helps.

            B
            Brad Matheny
            eSignal Solution Provider since 2000

            Comment


            • #7
              Again, to everyone who contributed, Thanks! I just broke down and wrote a mouse handler using a classic state machine. My user can click a button to draw the line, left-click on the first end--point, left-click on the second endpoint and the EFS uses the X,Y information to figure out how to draw the line and extend that line as new bars come in. In addition, it figures out the 'extended' values for that line to test against. It works really well. So, again, THANKS!!

              Thread closed.

              Comment


              • #8
                Any chance you can post your code? That would be an excellent addition to the code already contributed to the bb.

                Comment

                Working...
                X