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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        142 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        81 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        125 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        120 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        98 views
        0 likes
        Last Post CarlTrading  
        Working...
        X