Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

User drawn box on chart with mouse : NT8

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

    User drawn box on chart with mouse : NT8

    Hi,

    Could you please give me general direction for code to allow the user to draw a user defined box on the chart. I wrote code that will draw a box between two price bars if the user clicks on the first bar and then the second. I would like to adapt this code to do the following:

    The user clicks somewhere on the chart and drags his mouse while holding in the left mouse button to draw a box around a set of price bars. When the user releases the left mouse button, that would be the user defined box.

    My biggest problem at this point is the normal chart behavior that when a user left clicks on the chart and moves their mouse, the chart pans left and right. Not sure if this can be disabled in code for the period that the box is drawn.

    I am developing this specifically for NT8. Any direction would be greatly appreciated.

    Kind Regards,
    John Steinberg

    #2
    Would you mind sharing your code to see how it can be improved?

    Comment


      #3
      Hello,

      Thank you for the question.

      Based on the description, it sounds like you may be currently trying this using an Indicator, is this correct? If so what you have described sounds like it would be best suited to be a Drawing tool. A Drawing tool would have access to mouse events and an Anchor system just like all of the existing items, would this be of use in your idea?

      If so, I would suggest to review the existing drawing objects as these have mouse down concepts pre built in along with an Anchoring system and would provide a good example of what is required.

      If you need an indicator, you will have difficulties as the mouse actions of the chart are constantly happening because of the event subscriptions. A drawingtool is internally handled to allow for the appropriate mouse actions for placing and dragging items etc. If a indicator was required, could the user instead draw an existing Rectangle drawing tool and allow the Indicator to find that newly created object?



      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Custom Drawing Tool

        Hi Jesse,

        Thank you very much for the feedback. I started investigating custom drawing tools yesterday and you are right, this looks like exactly what I need.

        Really appreciate the help,
        John Steinberg

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mmenigma, Yesterday, 03:25 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kujista, Today, 05:44 AM
        0 responses
        7 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        9 views
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,281 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        18 views
        0 likes
        Last Post Irukandji  
        Working...
        X