Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy goes dead when going live

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

    Strategy goes dead when going live

    I came across a perplexing problem when putting a strategy live last night. The strategy processes historical bars but when it reaches the current date-time, it stops processing and I see no more logging from the onBarUpdate() to the Output window. It seems to stem from adding a daily time series.

    The logging to the Output window happens right up to the minute of going live, but then it stops.

    I have reduced the strategy down to 2 lines and I'm still seeing this issue. I have this now only:

    Code:
    protected override void Initialize()
    {
        CalculateOnBarClose = true;
        Add(PeriodType.Day, 1);
    }
    
    protected override void OnBarUpdate()
    {
        Print("Time==" + Time[0].ToString("yyyy-MM-dd HH:mm:ss") 
            + " Historical==" + Historical.ToString());
        
    }
    I'm attaching a screen shot of the parameter settings.

    I'm quite prepared to admit that I might be doing something idiotic - but so far I can't see anything in my setup.

    I have plenty of data in the HDM, both minute and daily, up to date.

    I tried adding different time series, and I can add extra time series with PeriodType.Minute, but not Daily.


    ps are you running a competition for interesting thread titles? I'm sure this one would win it
    Attached Files

    #2
    adamus, do you see the same if directly loading this setup from the chart? Did you ever see historical going to false in your Prints? It could be simply session templates then, you're on instrument settings here....
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand

      if I load up the 2 line strategy onto a 1-min EUR/USD chart, all I get is "**NT** Enabling NinjaScript strategy 'MyCustomStrategy...."

      I don't even seen my logging for the historical processing ramp-up period.

      I never do it this way so I have no experience with it. I use the Strategies tab exclusively. There's no DaysToLoad setting, so how does it know how much to process historically?

      EDIT: OK, I answered my own question with the chart. I set it to load 42 days (the same setting that I'm using for the Strategies tab strategies) and this time I see logging in the Output window but only with Historical=true. No bars log Historical=false at all. What does that mean?

      I have never seen Historical going to false in the Output window (for strategies running in the Strategies tab) either, unless I remove the PeriodType.Daily series.

      What is the issue with the session? All the instruments I trade have their session set to Forex in the Instrument Manager.
      Attached Files
      Last edited by adamus; 02-07-2011, 08:25 AM.

      Comment


        #4
        adamus, please try adding those CurrentBars checks for both series at your OBU() start -

        if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired) return;

        Then ensure enough historical bars are loading (daysToLoad, Lookback) and retry to check for the output prints.

        Thanks,
        BertrandNinjaTrader Customer Service

        Comment


          #5
          OK so I now have 3 lines in my strategy!

          I have daystoload=42 and barsrequired=21

          Still nothing - it stalls on the last historical bar and won't run live.

          no errors logged, by the way.

          Comment


            #6
            Adamus,

            You dont have any if(historical) checks in your code do you?

            If not then in this case I would need to have you send me your strategy to support at ninjatrader dot com and I can take a quick look at it.

            Reference this forum post when you send it in.

            I look forward to assisting you further.

            Comment


              #7
              Brett,

              it is literally the 2 line strategy that I posted in my first post above.

              Bertrand mentioned that it might be related to the session I am using - isn't that potentially the issue then when using the default 'forex' session?

              Comment


                #8
                Hi Adamus,

                What is the primary series you are running this against? This likely has to do with using CalculateOnBarClose = true setting on a daily series. A bar isn't "closed' until the next one begins. If this were applied on a daily series, there will be no real time processing of the strategy until the start of the next session.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Ryan,

                  I'm still not getting anything.

                  I took that CalculateOnBarClose statement out of the strategy, and I made sure it was set to false in the properties, and I re-enabled the strategy, but still it stopped at the last historical bar.

                  I tried it with a time series of 1440 minutes and it runs fine, but obviously I want the real day bars.

                  Have any of you guys tested this on the London time zone? Maybe what Bertrand said about the session is the issue.

                  Comment


                    #10
                    adamus, since I'm in Europe as well I tried on my other machine and still could not reproduce an issue - are you testing connected to a IB live account that would support daily data at all?
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Bertrand,

                      I use IQFeed for the historical data and IB for the live data. <br><br>I download historical data regularly at the end of the week from IB just to get their version of the data for testing. It includes daily data, unless the HDM is automatically generating it from the minute bars.

                      I do not know if there is a problem obtaining the daily bars for the real time system from IB's live feed. How would I establish that?

                      Comment


                        #12
                        You would for example connect to IB only see if you can get a correct, updating daily chart then.

                        Do you see the same issue if you're working with Kinetick live only here?
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          It looks as though there is something strange going on with my trading machine which connects to both IQFeed and IB.

                          On my other machine (WinXP-32) I connected to the IB simulation account and I was able to set up and run the strategy we're talking about here. The onBarUpdate processed every tick with CalculateOnClose=false, with the additional 1 day time series present. Once the historical processing was finished, I saw the logging from the event with historical=false printed to the Output window.

                          On the trading machine (Win7-64) it still doesn't work. This is the combination of IB for live streamed data and historical disabled, and IQFeed as secondary feed for historical data.

                          The daily bar chart doesn't update. In fact, it doesn't even show today's bar. In the properties for the chart I set today's date, but the last bar on the chart is yesterday. When the forex session finished and the new one started, still no bar appeared for the session that had just finished, until I hit 'reload all historical'.

                          I just disabled IQFeed, and now it all works as it does on the other machine.

                          So it looks very much like there is some kind of glitch there with the two connections.

                          Comment


                            #14
                            Thanks for the detailed reply adamus, I could reproduce your scenario here and will have development look into it.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              adamus, you unfortunately ran into a bug when trying to get the daily bar from Kinetick with IB connected first - this will be fixed with the next NT7 update, R4.

                              Thanks for your support and patience working this one out.
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              238 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              383 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Started by oviejo, Today, 12:28 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post oviejo
                              by oviejo
                               
                              Started by pechtri, 06-22-2023, 02:31 AM
                              10 responses
                              125 views
                              0 likes
                              Last Post Leeroy_Jenkins  
                              Started by judysamnt7, 03-13-2023, 09:11 AM
                              4 responses
                              59 views
                              0 likes
                              Last Post DynamicTest  
                              Working...
                              X