Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Resetting Variables

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

    Resetting Variables

    Hi,

    I'm trying to reset certain variables at the beginning of each session. I'm running my strategy on a 60 min chart, but I also have 15 min and 1 min bars added to the strategy. I'm also running it with COBC = false.

    I was trying this expression:

    if (Bars.FirstBarOfSession && BarsInProgress == 2)
    with BarsInProgress (2) being the 1 min bar. When looking at the output window though, I'm getting multiple resets for about the first 15 min, then the routine stops. My expectation is that it runs once and is done. Is it running on all the ticks during the first minute?

    I also have part of my strategy running on FirstTickOfBar. Should I put the routine in there?

    Thanks,

    Rich

    #2
    Hi Rich,

    Are you using version 6.5 or 7? There have been changes to multiseries for version 7 and want to make sure I'm checking this out for the right version.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I'm using version 7

      Comment


        #4
        Thanks.

        I believe this should work better for you.

        if (BarsInProgress == 2)
        {
        if (Bars.FirstBarOfSession && FirstTickOfBar)
        Print("First Bar of 1 minute " + Times[2][0]);
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I'll check it out tomorrow morning. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          368 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          571 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X