Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Detecting mouse click Events - Click on a Bar

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

    Detecting mouse click Events - Click on a Bar

    Hi,

    I would like some help on how to detect when the user clicks on a bar in the chart. I would probably have a button in the toolstrip to activate capturing the mouse clicks so that it doesn't override the normal selection of chart objects.

    I'd imagine this involves some sort of mouse event override function but I am not sure how to implement this. Can anybody give me some ideas, or point me to some code or indicator that has already implmented this? I'm guessing that I'm not the first person that has wanted to do this, but my forum searches so far haven't revealed a solution.

    Thanks,
    will.

    #2
    Hi Will,

    It is unsupported by NinjaTrader to detect a mouse click, but I do believe this is possible.

    Below is a link to a site that may assist with this.
    http://www.codeproject.com/Articles/10570/Mouse-Events
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea and thanks for the quick reply.

      Can you tell me, would the clicked bar index, or some other value referring to the clicked bar, be present in the eventargs structure?


      Thanks.
      Last edited by dontpanic; 02-06-2014, 05:02 PM.

      Comment


        #4
        Hello dontpanic

        No this would not be the case,

        You would need to find a way to find the bar using the x and y positions on the chart.

        I'm not quite sure how this would work. If I find further information I will let you know.
        Last edited by NinjaTrader_Matthew; 02-11-2014, 08:40 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I have seen some code (and have a copy) that apparently translates between screen coordinates and price/time, but I haven't tried it yet, but I imagine that it would do the trick.

          I still would believe that I'm not the first person who would have wanted this functionality, so I'm hoping there may be an example somewhere in the forums.

          Also, am I going to have to pass through the mouse event to the normal mouse click handler for events that I am not detecting? (ie, when my toolstrip button has not been pressed, mouse events go to the normal chart mouse handler)

          Thanks,
          will.
          Last edited by dontpanic; 02-06-2014, 05:05 PM.

          Comment


            #6
            Hi Will,

            If this has been discussed before, it is likely going to be in the unsupported thread.

            http://ninjatrader.com/support/forum...ad.php?t=22435

            I am not entirely sure about your question of passing the normal mouse events through. I recommend you ask in the unsupported thread.
            Last edited by NinjaTrader_ChelseaB; 02-07-2014, 08:11 AM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Dontpanic,

              If the code you have is not proprietary, could you please post the snippet that translates between a mouse click and a bar number? I've tried to work through a solution that works, but so far have not been successful. Thanks,

              Gordon

              Originally posted by dontpanic View Post
              I have seen some code (and have a copy) that apparently translates between screen coordinates and price/time, but I haven't tried it yet, but I imagine that it would do the trick.

              I still would believe that I'm not the first person who would have wanted this functionality, so I'm hoping there may be an example somewhere in the forums.

              Also, am I going to have to pass through the mouse event to the normal mouse click handler for events that I am not detecting? (ie, when my toolstrip button has not been pressed, mouse events go to the normal chart mouse handler)

              Thanks,
              will.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              213 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              544 views
              0 likes
              Last Post PaulMohn  
              Started by GLFX005, Today, 03:23 AM
              0 responses
              3 views
              0 likes
              Last Post GLFX005
              by GLFX005
               
              Started by XXtrader, Yesterday, 11:30 PM
              2 responses
              12 views
              0 likes
              Last Post XXtrader  
              Started by Waxavi, Today, 02:10 AM
              0 responses
              7 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Working...
              X