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

How to override PLOT to get mouse click?

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

    How to override PLOT to get mouse click?

    I want when user clicks mouse on chart:

    1) to alert "Mouse clicked" message
    2) to check, if specific KEYBOARD key is also pressed at the same time.

    is that possible with override PLOT() ?

    (btw, there are ways with custom c# even handler creations, but i wanted to know if there is a simple way with PLOT);
    Last edited by ttodua; 05-28-2018, 11:03 PM.

    #2
    Originally posted by TazoTodua View Post
    I want when user clicks mouse on char:
    Sorry, I am confused.
    You mean the chart or a character on the keyboard?

    Originally posted by TazoTodua View Post
    1) to alert "Mouse clicked" message
    This requires a mouse hook. I'll look around for an example.

    EDIT:
    Actually, it's called a "Mouse Event Handler".

    Originally posted by TazoTodua View Post
    2) to check, if specific KEYBOARD key is also pressed at the same time.
    Which key? It makes a difference, for ex, Shift/Ctrl/Alt keys (commonly used in conjunction with mouse clicks) would be different than a normal keyboard character.

    Originally posted by TazoTodua View Post
    is that possible with override PLOT() ?

    (btw, there are ways with custom c# even handler creations, but i wanted to know if there is a simple way with PLOT);
    I doubt it.
    Plot() doesn't have anything to do with the mouse.
    Plot() is ultimately an "output" function, not an "input" function.
    Last edited by bltdavid; 05-28-2018, 11:43 AM.

    Comment


      #3
      Hello TazoTodua,

      This would be outside of what is supported by NinjaTrader Support. However, this thread will remain open for any community members that would like to assist.

      With that said, I would recommend taking a look at the thread below about capturing the KeyDown event.


      And the custom cross hair for capturing mouse events.


      You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by bltdavid View Post
        This requires a mouse hook. I'll look around for an example.

        EDIT:
        Actually, it's called a "Mouse Event Handler".
        I went to Version 7 Indicators in Download section, and used the 'Keyword Filter' dropdown to select "Mouse". The indicator "dDrawABC" came up.

        I just checked the code, if you understand C# programming this looks to be a great example of what you'll want to do.

        The idea is to add an event handler for "MouseDown" to the ChartPanel (basically a reference to your own function that gets called on mouse down events).

        Inside your mouse down handler, check for your specific keypress being in down state at same time -- for ex, look at line 369 in dDrawABC.cs for an example using the 'Alt' key.
        Last edited by bltdavid; 05-28-2018, 12:19 PM.

        Comment


          #5
          1) yes, chart (was a spell error)
          2) lets say, i want CTRL (or ****)

          Comment


            #6
            Originally posted by TazoTodua View Post
            1) yes, chart (was a spell error)
            2) lets say, i want CTRL (or ****)
            I think you mean SHIFT ... another typo?

            Google for "C# Modifier Keys".

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cre8able, Today, 03:20 PM
            1 response
            9 views
            0 likes
            Last Post cre8able  
            Started by fiddich, Today, 05:25 PM
            0 responses
            3 views
            0 likes
            Last Post fiddich
            by fiddich
             
            Started by gemify, 11-11-2022, 11:52 AM
            6 responses
            804 views
            2 likes
            Last Post ultls
            by ultls
             
            Started by ScottWalsh, Today, 04:52 PM
            0 responses
            4 views
            0 likes
            Last Post ScottWalsh  
            Started by ScottWalsh, Today, 04:29 PM
            0 responses
            9 views
            0 likes
            Last Post ScottWalsh  
            Working...
            X