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

Unexpected result using .GetYByValue and GetXByTime

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

    Unexpected result using .GetYByValue and GetXByTime

    Hi,

    I've been working recently with

    ChartControl.GetYByValue(this, High[0])
    and
    ChartControl.GetXByTime(Time[0])

    The results of those two calls return the point shown on the attached screen capture. Rather than pointing to the currently forming bar (the data is live), I get the x and y coordinates for the high of the most recently completed bar.

    My goal is to get the information for the currently forming bar. Does anyone know how to do that (and why High[0] and Time[0], which work as I would expect in other calculations, do not produce the expected results when used with GetYByValue and GetXByTime)?
    Thanks,

    Gordon
    Attached Files
    Last edited by grose; 10-12-2016, 05:32 PM. Reason: Wording

    #2
    Is that a custom bar? Have you tried -1?
    What does high [0] return? Current bar or the one marked on the chart?

    Comment


      #3
      Hi Sledge,

      Thanks for your response. The bar type is a standard range bar bet there is an order flow indicator that seems to override the appearance of the bar. High[0] returns the bar marked on the chart.

      Do you know when to use -1 as an index into a price array and when to use 0 for the current bar?

      Regards,

      Gordon

      Comment


        #4
        Originally posted by grose View Post
        Do you know when to use -1 as an index into a price array and when to use 0 for the current bar?
        No.

        I was hoping it was some custom stuff offset by 1.

        Does the issue happen on plain Range Bar chart with only your code?

        Comment


          #5
          Hello,

          I wanted to check, what is the CalculateOnBarClose setting being used?

          The [0] values would report the most recent Closed bar with COBC = true, or the Building bar with =false.

          Could this potentially be the cause of the prior bar being referenced?

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by zstheorist, Today, 07:52 PM
          0 responses
          3 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          149 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          5 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post tkaboris  
          Working...
          X