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 WHICKED, Today, 12:45 PM
      0 responses
      1 view
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by FrazMann, Today, 11:21 AM
      2 responses
      6 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by rjbtrade1, 11-30-2023, 04:38 PM
      2 responses
      80 views
      0 likes
      Last Post DavidHP
      by DavidHP
       
      Started by Spiderbird, Today, 12:15 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by lorem, Yesterday, 09:18 AM
      5 responses
      18 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X