Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Bar data with two panels with two intervals

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

    Incorrect Bar data with two panels with two intervals

    This is in the context of creating a custom drawing tool, but it could exist in other places.

    If I create a new chart that's not time-based ("4 range" for example), then add a new panel (on the same chart) that is time-based ("1 minute" for example), I am getting incorrect results from "GetAttachedToChartBars().Bars.Count" (as well as .GetHigh(), etc)

    In other words, if there are two instruments on the same chart (separate panels), but their intervals create a different number of SlotIndexes (1 min chart vs 4 range chart), I'm having difficultly getting correct Bar information for my custom drawing tool.

    If both intervals are the same, then there is no problem.

    Perhaps I need to do something differently to specify the panel when calling "GetAttachedToChartBars()"?

    Any help or confirmation that this is a bug is greatly appreciated!

    #2
    Hello neoikon,

    Thank you for your post.

    How are you setting your Points? Can you attach your Drawing Tool's code?

    Comment


      #3
      My tool is based on the built-in "Rectangle" code. However, I was able to reproduce it using the builtin code as well.

      If I add the following to the first line of OnRender() in @Shapes.cs

      PHP Code:
      Print("Bars.Count: " GetAttachedToChartBars().Bars.Count "    EndAnchor: " EndAnchor.SlotIndex); 
      (I understand never modifying the builtin functions, but this is just to temporarily output the data)

      Then create a chart, as described in my first post (two instruments, in separate panels on the same chart, one 4R and one 5M).

      When I draw a rectangle on the top panel, then look at the output window, you'll see that the EndAnchor.SlotIndex (second value) is greater than the GetAttachedToChartBars().Bars.Count value, which shouldn't be (unless the rectangle is drawn in the future area).

      If you change both intervals to be the same interval (both 4R or both 5M), then you will see that the EndAnchor is less than the Bars.Count, as expected, since it's inside the count of the bars.

      Perhaps I am misunderstanding the relationship between Bar Count and SlotIndexes?

      If I look at EndAnchor.BarsAgo and EndAnchor.DrawnOnBar, they are equal to int.MinValue, so are of no use.

      I forgot to add that the reason this becomes problematic is when calling GetAttachedToChartBars().Bars.GetHigh(X), then it won't be the correct Bar as expected, if I am basing X on the StartAnchor/EndAnchor positions (looping through the bars in between them, for example).
      Last edited by neoikon; 02-29-2016, 03:44 PM.

      Comment


        #4
        Hello neoikon,

        Thank you for your response.

        This is described in the Help Guide as follows: "In a single series chart there will always be equal number of slots and bars, however for multi-series charts there may be additonal slots compared to the bar series your drawing tool resides."
        SlotIndex
        Last edited by NinjaTrader_PatrickH; 03-01-2016, 03:57 PM.

        Comment


          #5
          Thanks for the reply, but, unfortunately, that doesn't solve my problem or tell me how to achieve what I'm looking for.

          In this scenario, how do I find the bar index of one of the drawing tool's anchors in order to determine the High/Low of the bar that's at that same index?

          Or, loop through the bars between the two anchors and determine the highest high or lowest low bar.

          I can do these things no problem if the SlotIndex matches the Bar Counts. If the bar type is time based, then I could use the Anchor's time, then just add the "interval" to get the next bar time. However, the bar type is, obviously, not guaranteed to be time based.

          Thank you!
          Last edited by neoikon; 03-01-2016, 12:46 PM.

          Comment


            #6
            Hello neoikon,

            Thank you for your patience.

            I have not found a way around this. I will report to development.

            Comment


              #7
              Thanks for looking into this for me. I guess the good news is that I'm not crazy and there is an issue here.

              Perhaps there needs to be a way to translate SlotIndex to BarIndex, where most of the time they will be 1-to-1, but in this rare (?) situation there would need to be some kind of translation...

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cls71, Today, 04:45 AM
              0 responses
              1 view
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              213 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              544 views
              0 likes
              Last Post PaulMohn  
              Started by GLFX005, Today, 03:23 AM
              0 responses
              3 views
              0 likes
              Last Post GLFX005
              by GLFX005
               
              Started by XXtrader, Yesterday, 11:30 PM
              2 responses
              12 views
              0 likes
              Last Post XXtrader  
              Working...
              X