Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to find the right most bar Idx (Index)

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

    How to find the right most bar Idx (Index)

    Hi!

    I've been struggling to find the right most bar index.

    ie. If the last price is on the right side of the chart, right most index is 0.
    ie. If the user scrolls back in time, so the 10th bar is on the right side, it will return 10.

    Tried:

    chartMaxBars = ChartBars.ToIndex;
    chartWidthPixels = myChartScale.Width ;
    rightMostPixel = chartWidthPixels - 1;
    rightMostIndex = ChartBars.GetBarIdxByX(ChartControl, Convert.ToInt32(rightMostPixel));

    #2
    Hello Clydewallace,

    Thanks for your post.

    I think you are looking for ChartBars.ToIndex. "An index value representing the last bar rendered on the chart. "

    reference: http://ninjatrader.com/support/helpG...rs_toindex.htm

    Comment


      #3
      Thanks Paul.

      I am encountering some very strange behavior. Adding .ToIndex, and even using the sample code from the link you provided is causing NT8 to hard crash. Nothing in the log. And even trying to catch errors with a Try{}Catch does not prevent a hard crash.

      Comment


        #4
        Hello Clydewallace,

        Thanks for your reply.

        Are you using the latest version 8.0.6.1?

        Please run the attached indicator which is the exact sample only and test for the issue. If the issue repeats, please create a new workspace and a single simple chart with no templates and no indicators, please be sure to completely close all other workspaces to isolate.
        Attached Files
        Last edited by NinjaTrader_PaulH; 05-17-2017, 09:46 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        557 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X