Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing price data using BarsInProgress

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

    Accessing price data using BarsInProgress

    A simple doubt about this specific situation that I'd like to confirm that is what I think by logic.

    Let's suppose you Add a new Bar Object to the main instrument, in this example I'm gonna Add the Ask-data through this statement under Initialize () method:

    Code:
    Add(Instrument.FullName, PeriodType.Tick, 150, MarketDataType.Ask);
    Each time OnBarUpdate() method is called, the script will detect which one of the Bars Object updated, using the Statement

    Code:
    if (BarsInProgress == 0
    {
      // It was main instrument, do your logic
    }
    else
    {
      // It was the Ask-data series, do your logic
    }
    When the update comes from the Ask-data Bars object( BarsInProgress == 1 ) , then using in the script the following:

    1. A Close[0] would be the last ask price t?

    2. A Volume[0] would be the last ask volume ?

    3. GetCurrentAsk[0] would be the same as Close[0], right ?


    Thanks
    Last edited by pstrusi; 10-11-2015, 08:18 AM.

    #2
    Hello pstrusi,

    Thank you for writing in. You are correct in all but your final statement:
    3. GetCurrentAsk[0] would be the same as Close[0], right?
    GetCurrentAsk() is not accessed like an array so you use parenthesis and not brackets. The overload you would use is the following:
    Code:
    GetCurrentAsk(int barSeriesIndex)
    If you called GetCurrentAsk(1) it would equal Close[0] when BarsInProgress == 1.
    Please see our help guide here: http://ninjatrader.com/support/helpG...=getcurrentask

    Please let me know if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Thanks Michael for the clear answer, it's noted already.

      Comment


        #4
        Hello pstrusi,

        It is always my pleasure. Please have a great rest of your weekend!
        Michael M.NinjaTrader Quality Assurance

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 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
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X