Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

help with bars

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

    help with bars

    How would i go about programming something to the effect of when a certain event occurs, the strategy stops looking for trades for X amount of bars?

    #2
    Hello,

    I removed my first post as I misread your post.

    One way to do it is to start monitoring CurrentBar to see if it is >= to the bar number you want to start trading again:


    Give it a try and post your code for tips.
    Last edited by NinjaTrader_Ben; 06-19-2010, 09:31 AM.
    DenNinjaTrader Customer Service

    Comment


      #3
      so more or less
      counter = CurrentBar + X;
      while ( CurrentBar <= counter)
      {
      ;
      }
      that will keep the strategy in a loop that does nothing until the CurrentBar is greater than X, right?
      Could i use CountIf to get the same result?
      Last edited by laces2; 06-19-2010, 02:38 PM.

      Comment


        #4
        Hello,

        I think you have the idea, and I'm not 100% sure I understand what you want, but it seems like "counter" will always be greater than CurrentBar since:
        counter = CurrentBar + X;

        Make sure the above statement is only called once until the entire system resets. Otherwise the while block will not be called ever.
        DenNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        639 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        572 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X