Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding index within a strategy

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

    Adding index within a strategy

    Hi,
    I can pull up index charts, and I can add other instruments to my strategy, but when I try to Add() an index the strategy initializes but OnBarUpdate never executes. I've tried both IB and IQFeed as datasources (both with correct mapping), but neither works. What should I be doing?

    protected override void Initialize()
    {

    Add("DJIA", PeriodType.Minute, 1); // 1
    Add("YM 06-08", PeriodType.Minute, 1); // 2
    CalculateOnBarClose = false;
    Print("Initialized");
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {

    Print("Bar Update");
    }

    Thanks...

    #2
    You need to go by exact (!) NT instrument name which is "^DJIA".

    Comment


      #3
      Thanks,

      That almost fixed it - at first I had the same problem I often have when using Add() for new instruments, the strategy doesn't seem to force a download and therefore doesn't execute OnBarUpdate(). After a couple of tries, though, it downloaded the data and now works.

      Regarding the stocks, I often have to go through the list of stocks I'm using Add() with and open a chart for each in order to force a data download. Is there some way to ensure this works in the strategy itself? Or if not, is there some way to have NT (or the strategy) notify me which stocks need downloading, so I don't have to go through the entire list?

      Thanks again!

      Comment


        #4
        If you Add() a stock in a strategy, when you run the strategy, data will be downloaded for this. Are you saying this is not the case?
        RayNinjaTrader Customer Service

        Comment


          #5
          Yes, that's what I mean.

          When I add a stock that hasn't previously had any data downloaded, it sometimes doesn't work until I download the data via a chart. And there's no notification of which stock is causing the problem, or even that there is a problem (unless I have a "Print" statement in OnBarUpdate, and see that it doesn't execute).

          Comment


            #6
            How do yo figure that there really is no data in the DB yet for that instrument? OnBarUpdate not being triggered might not be a proper indication, since it only would be triggered after "min bars required" (default = 20) and you probably had less then 20 bar on the series in question.

            -> better set "min bars required" if you wanted to analyze this further

            Comment


              #7
              I will explore the use of 'min bars required,' that may explain it. But I'm a bit confused. When I apply a strategy to a chart, doesn't it automatically download the default number of bars?

              Comment


                #8
                It auto downloads data based on settings in Tools->Options->Data->Lookback in case data is not in the DB yet.

                Comment


                  #9
                  Well, that's what I thought. But again today I had to force a download chart by chart before the strategy would execute OnBarUpdate(). The strategy itself requires no historical data, it simply reads values from a file and then executes against intraday data once the session starts. Is there perhaps a limit on the number of instruments that can be added to a strategy?

                  Comment


                    #10
                    Josh will respond back later today with further instructions.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      palinuro,

                      Please ensure that your chart is pulling at least 20 days of data. Go "Format Data Series" and ensure that your "Days Back" range contains at least 20 actual trading days. Try a value of 40.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi Josh,

                        I tried that today, but it didn't help. Something else?

                        Comment


                          #13
                          Josh will follow up shortly

                          Comment


                            #14
                            There are a few guys working on the same issue. I suggest focusing further posts on this thread: http://www.ninjatrader-support.com/v...ad.php?p=37180

                            Comment


                              #15
                              Please try this -

                              - Connect to IQFeed
                              - Open the Strategy Analyzer
                              - Backtest AAPL
                              - 1 Minute Data
                              - Range from 1 month to today
                              - Press OK
                              - Does it backtest?
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bmartz, 03-12-2024, 06:12 AM
                              4 responses
                              31 views
                              0 likes
                              Last Post bmartz
                              by bmartz
                               
                              Started by Aviram Y, Today, 05:29 AM
                              4 responses
                              12 views
                              0 likes
                              Last Post Aviram Y  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              3 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by gentlebenthebear, Today, 01:30 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by cls71, Today, 04:45 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X