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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        308 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        349 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X