Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to detect chart horizontal scrolling?

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

    How to detect chart horizontal scrolling?

    I have an indicator that displays data for the bar the mouse is on. I update it from OnMouseMove(). That works well -- I move the mouse, the data updates, and the data I draw is is positioned correctly..

    The problem is when I do not move the mouse -- I just scroll the chart. How do I detect that so I can redraw the changed data? I have Googled quite a bit, but not found anything very helpful.

    What I really need is to know whenever the mouse points to a different bar.

    --EV
    Last edited by ETFVoyageur; 08-14-2016, 10:30 AM.

    #2
    Hello EV,

    Thank you for your post.

    You could use Mouse.GetPosition inside of an event that would be called on the adjustment of the chart such as OnRender(). Or you could call Mouse.GetPosition on a custom event that you call based on a timer.

    For example in OnRender():
    Code:
    		protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    		{			
    			Point position = Mouse.GetPosition(chartControl);
    			int test = Convert.ToInt32(chartControl.GetSlotIndexByX(Convert.ToInt32(position.X)));
    			Print(Bars.GetTime(test));
    		}
    For triggering a custom event please visit the following link: http://ninjatrader.com/support/helpG...ustomevent.htm

    Please let me know if you have any questions.

    Comment


      #3
      Thanks, Patrick. I thought I had tried that, but obviously I thought wrong. Works fine.

      Sorry,
      --EV

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      670 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X