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

Equivalent IBar Interface of NT7 in NT8

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

    Equivalent IBar Interface of NT7 in NT8

    Hi,
    Was looking for Equivalent IBar Interface for of in NT8.

    IBars in NT8 has a totally different interface. Any suggestions?

    Regards

    Vivek

    #2
    Hello AnkaS,

    Thank you for your post.

    As IBar was not documented in NinjaTrader 7 can you detail what you used it for and I can provide the equivalent in NinjaTrader 8?

    Comment


      #3
      I came here wanting to ask the same question. Let me give you an example of how I used IBar in NT7, hoping that you can advise me on how to transition my code to NT8:

      Case 1 - Get an absolute bar by index

      Code:
              var bar = Bars.Get(i);  // Get the i-th bar
      Case 2 - Bar Math

      Code:
              public static double Height(IBar bar)
              {
                  return bar.High - bar.Low;
              }
      
              public static double Top(IBar bar)
              {
                  return Math.Max(bar.Open, bar.Close);
              }
      
              public static double Bottom(IBar bar)
              {
                  return Math.Min(bar.Open, bar.Close);
              }
      It looks like you've removed Bars.Get(int) from NT8, so I'll have to change my Bar Math functions to take an index and a Bars object, e.g.:

      Code:
              public static double Bottom(Bars b, int i)
              {
                  return Math.Min(b.GetOpen(i), b.GetClose(i));
              }
      It's not the end of the world, but it's certainly not as elegant as before.

      Is there a better way? Please advise.

      PS. Overall, I love the changes in NT8

      Comment


        #4
        Hello xsgex,

        Thank you for your post.

        The means in which you are handling this would make sense in context to what you did in NinjaTrader 7. I do no see a better way to achieve this.

        Please let me know if you have any questions.

        Comment


          #5
          finally, what is the equivalent of IBar object and how to get in NT8?

          Comment


            #6
            Hello TazoTodua,

            Thank you for your post.

            IBar was undocumented in NinjaTrader 7, this means that if it's equivalent is in NinjaTrader 8 we would need to know what you use IBar for to then provide the desired operation in NinjaTrader 8.

            I look forward to your response.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jclose, Today, 09:37 PM
            0 responses
            5 views
            0 likes
            Last Post jclose
            by jclose
             
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            10 responses
            1,414 views
            0 likes
            Last Post Traderontheroad  
            Started by firefoxforum12, Today, 08:53 PM
            0 responses
            11 views
            0 likes
            Last Post firefoxforum12  
            Started by stafe, Today, 08:34 PM
            0 responses
            11 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by sastrades, 01-31-2024, 10:19 PM
            11 responses
            169 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X