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

Daily Strategy?

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

    Daily Strategy?

    I am back testing a daily strategy against multiple instruments to see what instruments I need to trade against tomorrow. I am only interested in trading daily bars. That is I want to do my analysis in the evening and in the morning be for I head off to my day job place my limit orders and see how they did in the evening after the market closed. What I am doing does not seem like it is going to work and I am not sure what I need to do differently. My issue is:
    I run a back test on a stock. I add a print statement to the OnBarUpdate method:

    protectedoverridevoid OnBarUpdate() {
    Print(Time[0].Date.ToShortDateString());

    The last bar on the chart is 7/1/2009

    My output reads:
    Initialize
    Initialize
    6/26/2009
    6/29/2009
    6/30/2009


    I originally thought since I have the 7/1/2009 data and since I can see the bar on the chart that the OnBarUpdate event would have fired, but I guess that is not the case.

    How do I get around this?
    Multiple time frames Add(PeriodType.Minute, 60)???
    I basically need to know what Instruments I need to open strategies for in the morning so I can trade them.

    Thanks,
    Erik


    #2
    Erik,

    This happens because NinjaTrader does not close a bar until the opening of the next bar. That means you do not receive a 7/1 OnBarUpdate event until 7/2 comes along.

    You can try adding that intraday granularity to get the prices for that last bar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      When I connect to my MB Trading Demo account and run a back test against a simple strategy if I try to use Type = Minute instead of Type=daily I don't see any bars and my print statement below does not print anything? I am using Yahoo as the backup. Is there any way using my MB Trading demo account to get minute bars? I wrote a C# app using their api and I can see historical minute data so I thought this would be possible?

      Thanks,
      Erik

      Comment


        #4
        Please see this article: http://www.ninjatrader-support.com/H...HistoricalData

        Historical minute is not supported on MBT.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          MB Trading Adapter
          - Added support for MBT historical data
          - Added option to drive streaming level 1 data from either snap shot data or time & sales data
          - Fixed issue where redundant execution events were thrown after recovery on a loss of connection


          Does this mean minute data will be available in NT 7?

          Thanks,
          Erik

          Comment


            #6
            Sure does.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              I have another question on this subject.

              If I do the following:
              1. Connect to my data source and run a strategy up to current day (7/8/2009).
              2. Disconnect from my data source (using historical data on my hard-drive now).
              3. Create a file for say INTC that looks something like this (mock data for tomorrows bar - I really do not care about it at this point):
              20090709;2.00;3.00;1.00;2.10;200
              4. Import it (now I can run my historical test to see if I want to Trade INTC tomorrow based on how OnBarUpdate handles 7/8/2009's data).

              Question: The next day (evening of 7/9/2009) when I repeat the process the historical data added in step 3 above will be overwritten by step 1 above. Is this correct? Will messing with the historical data like this cause problems with the software?

              Thanks,
              Erik

              Comment


                #8
                If you want it to overwrite the data you import just tell NinjaTrader to reload historical data and it will load whatever it has again. If you want to start a day fresh, you can delete data for the day you do not want.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh,

                  What do you mean by until 7/2 comes along? I am trading daily bars with calculate on close = true, so will 7/1 OnBarUpdate fire the morning of 7/2 or end of day 7/2 when the 7/2 bar paints on my chart.

                  Thanks,
                  Erik

                  Originally posted by NinjaTrader_Josh View Post
                  Erik,

                  This happens because NinjaTrader does not close a bar until the opening of the next bar. That means you do not receive a 7/1 OnBarUpdate event until 7/2 comes along.

                  You can try adding that intraday granularity to get the prices for that last bar.

                  Comment


                    #10
                    7/1 bar does not close till 7/2 bar begins. No OnBarUpdate() is received till the bar closes.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Today, 06:53 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post algospoke  
                    Started by mlprice12, 12-21-2021, 04:55 PM
                    3 responses
                    291 views
                    0 likes
                    Last Post paypachaysa  
                    Started by lorem, 04-25-2024, 09:18 AM
                    20 responses
                    85 views
                    0 likes
                    Last Post lorem
                    by lorem
                     
                    Started by xepher101, 05-10-2024, 12:19 PM
                    4 responses
                    52 views
                    0 likes
                    Last Post xepher101  
                    Started by DawnTreader, 05-08-2024, 05:58 PM
                    22 responses
                    82 views
                    0 likes
                    Last Post DawnTreader  
                    Working...
                    X