Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy: Missing Bars?

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

    Strategy: Missing Bars?

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    ExitOnClose = false;
    BarsRequired = 0;
    Add(PeriodType.Day,1); //Add 1 day bar

    }
    protected override void OnBarUpdate()
    {
    if(BarsInProgress == 0) //Primary bar
    Print("1minbar "+CurrentBar.ToString());
    if(BarsInProgress == 1) //The added 1day bar
    Print("1daybar "+CurrentBar.ToString());
    }


    Output:
    1daybar 1
    1minbar 1146
    1minbar 1147
    1minbar 1148
    1minbar 1149
    1minbar 1150
    ...

    Why doesn't the 1min bar start at 1 ? instead of 1146. That means if I want to buy/sell on the min bar I need to wait for bar 1146. How is that acceptable ??

    If I remove the add() statement I get
    1minbar 1
    1minbar 2
    1minbar 3
    1minbar 4
    1minbar 5
    ...

    As expected
    Last edited by nohedge; 10-25-2011, 06:55 PM.

    #2
    nohedge, I ran you test as well to see what is happening here. It appears as if the first day's data is not being run through the analyzer. I will have someone else get back to you on Monday with more clarification on this.

    The test I ran used 15 minute bars instead of one minute bars (test starting 10/17) to reduce the amount of data generated:
    Code:
    10/18/2011 12:00:00 AM BIP: 0 CurrentBar: 125
    10/18/2011 12:15:00 AM BIP: 0 CurrentBar: 126
    10/18/2011 12:30:00 AM BIP: 0 CurrentBar: 127
    -snip-
    10/18/2011 11:30:00 PM BIP: 0 CurrentBar: 216
    10/18/2011 11:45:00 PM BIP: 0 CurrentBar: 217
    10/19/2011 12:00:00 AM BIP: 0 CurrentBar: 218
    10/19/2011 12:00:00 AM BIP: 1 CurrentBar: 1
    10/19/2011 12:15:00 AM BIP: 0 CurrentBar: 219
    AustinNinjaTrader Customer Service

    Comment


      #3
      missing bars

      Thanks. That would be great. Its currently blocking my evaluation process.

      Hopefully its my poor coding thats doing this!

      Comment


        #4
        nohedge, thanks for the patience - that would be expected if you add daily data to your script, even if you work on BarsRequired = 0.

        Comment


          #5
          That would be expected ?..really? would that mean I have to wait days before my 1min strategy buys something?

          Can you tell me how this is documented ?


          What I want to do is find out the ATR(14day) at minute bar 0.

          //primary bar is 1 min of CROX
          protected override void Initialize()
          {
          CalculateOnBarClose = true;
          ExitOnClose = false;
          BarsRequired = 0;
          Add(PeriodType.Day,1);

          }

          protected override void OnBarUpdate()
          {

          if(BarsInProgress == 0)
          Print("1minbar "+CurrentBar.ToString());
          if(BarsInProgress == 1)
          Print("1daybar "+CurrentBar.ToString());

          }

          1daybar 1
          1minbar 1180
          1minbar 1181
          1minbar 1182
          1minbar 1183
          ...
          Last edited by nohedge; 10-25-2011, 06:37 AM.

          Comment


            #6
            nohedge, I'm not sure what you mean by 'days', but it would take one daily bar update for the OnBarUpdate() calls to come here in this config. I will a suggestion to add this to our docs, thanks for pointing that out.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X