Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Intrabar Price

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

    Intrabar Price

    Hi,

    I am having difficulty understanding exactly how intrabar data comes in. What I want to do is something like:

    if Price > previous bar high do something

    So if CalculateOnBarClose = true, I could write:

    if(CalculateOnBarClose)
    {
    if(Close[0] > High[-1])
    { .... }
    }

    But if CalculateBarOnClose = fase, how do I do this?
    I need to know how to access price on an intrabar basis. So far I have found the following possibilities but there are contradictions:

    1. I need to add a data seies and in this way add granularity
    2. I can use Bars.Instrument.MasterInstrument.FormatPrice(thisP rice)
    3. I can use Gui.Chart.ChartControl.FormatYValue(price)
    4. Time[0]

    Can someone please help me? I need to find a way to access price intrabar.
    Thank you very much.

    #2
    Hello Zeos,

    For bar indexing, you always want to use positive values. [0] refers to the most recent and the one prior to this is [1]. For help using [ ], see the following forum post:


    If you want to compare the most recent price to the previous bars high when COBC = false, this is done simply with:
    if (Close[0] > High[1])
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you Ryan,

      My apologies on the indexing with -1. It was a typo that slipped in but thank you for catching it.

      So if I am to understand this, Close[0] will always refer to the most recent price whether COBC is true or false. Is this correct?

      Comment


        #4
        So if I am to understand this, Close[0] will always refer to the most recent price whether COBC is true or false. Is this correct?
        No, that is only true when COBC = false. When COBC = true, then the values you're accessing refer to the last closed (finished) bar, not the most recent price.

        If you need access to the most recent price when COBC = true, you can work within OnMarketData() event handler:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Got it. Thank you very much.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X