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

Add(PeriodType.Day,1); Issue

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

    Add(PeriodType.Day,1); Issue

    Hello,
    I have an indicator in a 5000 Volume bar chart. When the first bar closes on a new day (after midnight) I need to access the prior days OHLC data which I am trying to do by accessing daily bars:
    protected override void Initialize()
    {
    Add(PeriodType.Day,1); // Add the daily bars to the indicator
    // Other code...
    }

    protected override void OnBarUpdate()
    {
    daysback = 0;
    tempDate = Convert.ToDateTime(Times[1][daysback].ToShortDateString());
    yHigh = Highs[1][daysback];
    yLow = Lows[1][daysback];
    yClose = Closes[1][daysback];
    }

    The problem is that the most recent data available is not from yesterdays session, but from a day ago. For instance, right now at 2:00AM Friday morning (10/5/2012), the most recent daily bar is from 10/3/2012.

    When is the daily bar from 10/4/2012 added? Can I force it to update somehow? It has not been updating, even after the market opens at 9:30 Eastern. (Pressing F5 does not help.)

    This same indicator works on a 25000 Volume chart, I don't know why it's having issues with the 5000 Volume chart.

    Is there a better way to access OHLC data from prior days?

    Thanks,

    Roger


    #2
    Hi Roger, the new daily bar will need to open / have received the first tick to close the prior one, so you can access it.

    I would suggest using GetDayBar or PriorDayOHLC here as replacement for your needs.



    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by benmarkal, Yesterday, 12:52 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    18 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X