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

TradeRuler / Middle Mouse Button on Charts

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

    TradeRuler / Middle Mouse Button on Charts

    I do love the "TradeRuler" from the "NT7 Indicators" section in this forum, and I'd like to have it in NT8, or at least sort of a "light" version. To begin with I'd need some advice about how to draw a short horizontal line at the High of a bar when middle-clicking below that bar or draw a horizontal line at the Low of a bar when middle-clicking somewhere above that bar.

    How can I deal with a middle mouse button event on the Ninja charts in NT8?
    How can I evaluate whether the mouse click happened either above or below a bar on the chart?
    How can I find out above/below WHICH bar the middle button was clicked (bar number)?
    How can I draw a short horizontal line that begins at the High or Low of a specific bar?

    Perhaps someone could give me one or the other hint about how to begin? To me, missing such a TradeRuler "light" is one of only two or three missing pieces preventing me from switching to NT8.

    #2
    Hello RonnyKeller,

    This is not documented in the help guide, but you might try adding an event handler to the panel's MouseDown event.

    For example:
    Code:
    else if (State == State.DataLoaded)
    {
    	ChartControl.ChartPanels[0].MouseDown += MiddleMouseButtonExample_MouseDown;
    }
    else if (State == State.Terminated)
    {
    	ChartControl.ChartPanels[0].MouseDown -= MiddleMouseButtonExample_MouseDown;
    }
    Code:
    public void MiddleMouseButtonExample_MouseDown(object sender, MouseButtonEventArgs e)
    {
    	Print((e.MiddleButton == MouseButtonState.Pressed).ToString());
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Perhaps I misunderstand, but how would this code-snippet help me decide on which bar the middle-button was clicked, or whether is clicked above / below a certain bar?

      Comment


        #4
        Hello RonnyKeller,

        The suggested code shows how to capture a middle mouse click. You would get the x and y coordinates from the mouse click and then use custom logic to compare this with price or time values on the chart.

        Below is a link to an example.


        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


          #5
          Thanks a lot, ChelseaB - your examples helped me to create my simple Risk-Ruler as uploaded recently to the NT8 AddOn-section

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by funk10101, Today, 12:02 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by GLFX005, Today, 03:23 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by nandhumca, Yesterday, 03:41 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by The_Sec, Yesterday, 03:37 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by vecnopus, Today, 06:15 AM
          0 responses
          1 view
          0 likes
          Last Post vecnopus  
          Working...
          X