Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetDayBar Question

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

    Bars.GetDayBar Question

    Hi
    I wrote this code - expecting to see the Bars.GeDayBar(1) return data from the prior day.

    if (Bars.GetDayBar(1) != null)
    {
    writeit1 =
    "Today : "+Time[0].DayOfWeek+" "+Time[0].Date.ToShortDateString()+" "+Time[0].TimeOfDay.ToString()
    +
    ";" +Bars.GetDayBar(1).Time.ToLongDateString()
    +
    ";" +Bars.GetDayBar(1).Open.ToString()
    +
    ";" +Bars.GetDayBar(1).High.ToString()
    +
    ";" +Bars.GetDayBar(1).Low.ToString()
    +
    ";" +Bars.GetDayBar(1).Close.ToString()
    +
    ";" +Bars.GetDayBar(1).Volume.ToString()
    +
    ";" +Bars.GetDayBar(1).FirstBarOfSession.ToString()
    +Environment.NewLine;

    Print (writeit1);



    Instead - it appears that Bars.GetDayBar(1) is returning data from 3 days prior. Here is the output to the output window:

    Today : Tuesday 3/5/2013 00:00:00;Friday, March 01, 2013;1500.75;1513;1494;1510.75;8886;False
    Today : Wednesday 3/6/2013 00:00:00;Friday, March 01, 2013;1500.75;1513;1494;1510.75;8886;False
    Today : Thursday 3/7/2013 00:00:00;Monday, March 04, 2013;1507.25;1520.5;1505.25;1520.5;12829;False
    Today : Friday 3/8/2013 00:00:00;Tuesday, March 05, 2013;1526.75;1537.25;1526.5;1532;36076;False




    #2
    The code you have here appears to be working correctly on my end.

    Have you ensured the data is available on the chart being used? When you right click the chart -> reload historical data does this resolve the issue?

    Who is your data provider?

    What instrument are you testing?

    What session template are you using?
    LanceNinjaTrader Customer Service

    Comment


      #3
      Lance - I have attached a .JPG of the chart and the data series settings
      Instrument ES0613
      Provider Zenfire
      Session Template Default 24*7

      There should be plenty of data in the chart (see .jpg) -- I tried reloading historical data and got the same result
      Thanks
      Attached Files

      Comment


        #4
        I'm loaded up Zen-Fire with the same chart as you and receive the following when running the following script


        Code:
        if (Bars.GetDayBar(1) != null) 
        			{
        				writeit1 =
        				"Today : "+Time[0].DayOfWeek+" "+Time[0].Date.ToShortDateString()+" "+Time[0].TimeOfDay.ToString()
        				+"; Yesterday:  " +Bars.GetDayBar(1).Time.ToLongDateString()
        				+";" +Bars.GetDayBar(1).FirstBarOfSession.ToString();
        
        				Print (writeit1);
        			}
        Output:
        Today : Thursday 3/21/2013 22:00:00; Yesterday: Wednesday, March 20, 2013;False
        Today : Friday 3/22/2013 22:00:00; Yesterday: Thursday, March 21, 2013;False
        Today : Monday 3/25/2013 22:00:00; Yesterday: Friday, March 22, 2013;False
        Today : Tuesday 3/26/2013 22:00:00; Yesterday: Monday, March 25, 2013;False
        Today : Wednesday 3/27/2013 22:00:00; Yesterday: Tuesday, March 26, 2013;False
        Today : Thursday 3/28/2013 22:00:00; Yesterday: Wednesday, March 27, 2013;False
        If you're not getting this please try posting the exact script you're using or see how my script differs from yours.
        Located in (MY)Documents\NinjaTrader 7\bin\Custom\ indicator/strategy
        LanceNinjaTrader Customer Service

        Comment


          #5
          Lance
          I repaired the DB, reset the DB and reset the instrument list
          The problem has gone away!
          Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          630 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          566 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X