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 cmoran13, Yesterday, 01:02 PM
          0 responses
          27 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          18 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          160 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          95 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          148 views
          2 likes
          Last Post CaptainJack  
          Working...
          X