Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PeriodType.Day not updating

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

    PeriodType.Day not updating

    Hi, I have a strategy that was working just great when my default period was day and I had the minute bars as a secondary timeframe. I rewrote the thing to use the minute bars as the default period and day as the secondary timeframe. My Initialize block now looks like this:

    Add(PeriodType.Day, 1);
    Add("DIA",PeriodType.Minute, 1);
    Add(PeriodType.Minute, 15);

    The following values are set on the Edit Strategy window:
    Type: Minute
    Value: 1
    Days to load: 12
    Maximum bars look back: TwoHundredFiftySix
    Min bars required: 21

    The strategy never fires because Historical is always false. I added some displays and found that the only values of BarsInProgress are 0, 2, and 3, which means NT's never processing the daily bars and also never building up enough history for that BarsArray.

    It seems like other people have experienced the same issue, and there doesn't seem to be a definitive solution to the problem in those threads.

    The workaround is to rewrite the code to use daily bars as the primary timeframe, but then I lose other valuable variables that don't seem to have comparable values for multiple timeframes: Bars.BarsSinceSession, BarsSinceEntry, BarsSinceExit. Any ideas?

    #2
    Hi Eric,

    Thanks for posting. What you're probably running into is that "minimum bars required" must be satisfied for the added series in your strategy before it will start processing real time updates for that series.

    Since you're loading only 12 days, but have minimum bars required as 20, it won't ever trigger unless the strategy remains on for 8 days after you enable it. Reducing minimum bars required to a smaller number, or increasing days to load will likely be the easiest way to resolve.
    Last edited by NinjaTrader_RyanM1; 02-21-2012, 02:03 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi RyanM,

      I tried a few different combinations for Days to load and Min bars required. Even if they're both set to 2, the strategy never fires. One of the things I'm displaying is BarsInProgress, and the values are always 0, 2, and 3. 0 is the minute bar, and you'd expect a record with BarsInProgress = 0 on every print. But, you'd also expect a record with BarsInProgress = 1 on every print, since the value of Close[1][0] is theoretically updating on every print. It is acting as if CalculateOnBarClose were set to true, but it is set to false both in the code and in the Edit Strategy window.

      Comment


        #4
        Yes, you should get updates to all BIPs in real time with COBC = false. There's not much harm in loading extra days of history, so I would be generous here with both settings to make sure that minimum bars required isn't stopping you from seeing these real time daily updates.

        Change days to load setting = 10 and minimum bars required = 0. If it works OK with these settings, you can adjust them more/less depending on what you're going for. If it's still not working the way you expect, I'm happy to take a look at your strategy and setup details (connection, instrument, and strategy settings).
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi RyanM,

          That did it! Now I see all four timeframes, and Historical is set correctly. I tried many combinations for the settings, but never Min bars required = 0. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PaulMohn, Today, 05:00 AM
          0 responses
          2 views
          0 likes
          Last Post PaulMohn  
          Started by ZenCortexAuCost, Today, 04:24 AM
          0 responses
          5 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by ZenCortexAuCost, Today, 04:22 AM
          0 responses
          2 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by SantoshXX, Today, 03:09 AM
          0 responses
          15 views
          0 likes
          Last Post SantoshXX  
          Started by DanielTynera, Today, 01:14 AM
          0 responses
          3 views
          0 likes
          Last Post DanielTynera  
          Working...
          X