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

Mixed time frames

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

    #16
    Have you tried what I posted in my last post?
    RayNinjaTrader Customer Service

    Comment


      #17
      Yes, from the tests I did, it occurred at midnight. Subsequent tests of GetSessionBar also refer to the YM

      Run without time constraint -
      28/02/2008 00:00:00 session close is: 12582.18 time 28/02/2008 00:00:00
      28/02/2008 00:01:00 session close is: 12526 time 28/02/2008 00:00:00

      Run with time constraint of after 16:00 and less than 16:03, I get
      28/02/2008 16:01:00 session close is: 12526 time 28/02/2008 00:00:00
      28/02/2008 16:02:00 session close is: 12526 time 28/02/2008 00:00:00

      Comment


        #18
        You will need to play around more. It works as expected indpendant of session settings.

        If you create a strategy with only the following code in OnBarUpdate() on one series you will see proof in the Output window.

        if (Bars.GetSessionBar(1) != null)
        Print(Time[
        0].ToString() + " " + Bars.GetSessionBar(1).Time + " " + Bars.GetSessionBar(1).Close);

        RayNinjaTrader Customer Service

        Comment


          #19
          Ray,

          Your code is for yesterday's (1) data. It doesn't update until midnight. It may work as expected but is not doing what is needed.

          Comment


            #20
            If today you run this code, it will return the close price from yesterday calculated from the intraday data.
            RayNinjaTrader Customer Service

            Comment


              #21
              Having some what of a similar problem but I am using Daily (primary) and weekly (secondary) data. Using Print() statements I see:

              2/29/2008 12:0:00AM[0]
              2/29/2008 12:00:00AM[1]
              3/3/2008 12:00:00AM[0]
              3/4/2008 12:00:00AM[0]
              3/5/2008 12:00:00AM[0]
              3/6/2008 12:00:00AM[0]

              This is running the Strategy Analyzer on Sunday, March 9th. As you can see, there is no daily entry 3/7/2208 or a weekly entry for 3/7/2008. Looks like it will not consider Friday to be complete until Monday's data has been added.

              I have played around with the session parameters and that has not gotten NT to consider Friday to be complete. I double checked the chart and the chart is showing a daily bar for 03/7/2008.

              Is there something I'm missing or is this the way NT works?

              Thanks

              Comment


                #22
                When CalculateOnBarClose is set to true (which is the setting for backtesting) it will not include the final bar because it does not know that it has "closed" yet. This is the way NT works with historical data. In real-time you can set CalculateOnBarClose to false and you will get prints on the final bar.
                Josh P.NinjaTrader Customer Service

                Comment


                  #23
                  Ray,

                  I set the daily data up as 1 minute at 4 pm (160000). I then accessed the data as minute data and NT obliged. Obviously not the correct solution but it will do for the time being.

                  e.g.
                  20080228 160000;12689.28;12713.99;12463.32;12582.18;3938580
                  20080229 160000;12579.58;12579.58;12210.3;12266.39;4426730

                  Eric

                  Comment


                    #24
                    Excellent
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by patrickmlee007, Today, 09:33 AM
                    2 responses
                    15 views
                    0 likes
                    Last Post patrickmlee007  
                    Started by magnatauren, 08-15-2020, 02:12 PM
                    5 responses
                    206 views
                    0 likes
                    Last Post RaddiFX
                    by RaddiFX
                     
                    Started by rene69851, 05-02-2024, 03:25 PM
                    1 response
                    21 views
                    0 likes
                    Last Post rene69851  
                    Started by ETFVoyageur, Yesterday, 07:05 PM
                    5 responses
                    45 views
                    0 likes
                    Last Post ETFVoyageur  
                    Started by jpeep, 08-16-2020, 08:31 AM
                    13 responses
                    487 views
                    0 likes
                    Last Post notenufftime  
                    Working...
                    X