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

Posible x,y coordinate bug(?) when Scale Justification changes

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

    Posible x,y coordinate bug(?) when Scale Justification changes

    I found an 'anomaly' when conparing the value returned by:
    - mouseEventArgs.GetPosition(ChartControl) versus
    - ChartControl.MouseDownPoint.

    I found that when all indicators have their Scale justification set to Right, the values are the same. However, if an indicator is switched so it's Scale justification is set to Left, then the X value returned is different by quite a bit.

    To demonstrate this issue, I have attached two indicators. One prints the x/y coordinates of mouse clicks on the chart. The other plots the Close value as a line.
    Open the output window.

    To see things work correctly, load both indicators on a chart and click somewhere in the chart. Observe the output window. There should be two lines printed showing the x/y coordinates, one set obtained from GetPosition, the next set obtained from MouseDownPoint.

    To see the bug, Change the Scale justification of GTestIndicatorShowingOnLeftMargin to be Left.
    Now when you click on the chart, the X values of the two sets of coordinates are different.

    I assume ChartPanel.MouseDownPoint is the ninja supported way of determining mouse click coordinates. If GetPosition is not a supported technique, then it should be clearly documented with warnings.

    New Feature request:
    If ChartPanel is the only correct way to determine the mouse coordinates, then there needs to be a new public property/method added to track the coordinates of a MouseMove event (since there is no down click in this event, the MouseDownPoint provided by Ninja does not help).

    Gary
    Attached Files

    #2
    Hello GaryAlbers,

    Thank you for the concise and straight forward report!

    We're taking a closer look and I will update this post with our findings.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello GaryAlbers,

      So after a closer look we see that the code is comparing the coordinates from ChartPanel to the coordinates from ChartControl. ChartPanel coordinates will adjust with the margin, while the ChartControl will contain the margin and the coordinates will be unaffected.

      My lead has created a graphic that can be used to visualize. I've attached it to this post.

      I've also requested that this is detailed in the MouseDownPoint page of the help guide.

      Please let me know if I can be of further assistance.
      Attached Files
      JimNinjaTrader Customer Service

      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