Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartControl.GetXByTime() returns negative value

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

    ChartControl.GetXByTime() returns negative value

    Hi,

    I call ChartControl.GetXByTime() in an indicator. When the indicator is running on a chart with live data, the function call returns a negative value. I have the indicator calculated to update tick by tick (CalculateOnBarClose = false) and I use an index value of 1 to look one bar back.

    Has anyone seen this behavior and does anyone know of a fix?

    Thanks,

    Gordon

    #2
    Hello Gordon,

    As a heads up, ChartControl.GetXByTime() is not documented in the NinjaTrader help guide.

    If you are printing in OnBarUpdate and allowing for prints to be made historically, this will print for each historical bar on the chart (including the ones not visible to the left of the chart).

    For any bars that are to the left of the chart, these will have a negative value.

    For any bars visible on the chart, these will have a positive value.

    Are you viewing multiple prints?
    If so, are all of the prints producing negative values, or are the most recent prints at the bottom with positive values?
    Last edited by NinjaTrader_ChelseaB; 10-18-2016, 10:47 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for your answer. I realized this was happening if the chart was minimized, and that makes sense. It was tough at first to see the connection and then it hit me. It appears the window can't be minimized and of course the bar referenced has to be visible on the chart (if the referenced bar has been scrolled out of view, then the x coordinate won't be on the visible chart either). Hopefully all of this will help someone down the road with the function and the values it returns.

      Regards,

      Gordon

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      559 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
      546 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