Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

range bar count since time

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

    range bar count since time

    Hi,
    Which functions would i need to use to determine the # of range bars which have closed since a specific time? For example, i want my strat to only consider the first 4 bars that have closed since a point in time, so, the current (and final bar in my test of 4 bars) bar = bar #3 since 9:30 am (given the first bar since 9am is called bar #0)
    thanks,
    David

    #2
    Hello trader3000a,

    Thanks for your post.

    Something you could consider is creating a condition that checks for the specified time and saves the CurrentBar value of that bar to a variable. Then, you could subtract that variable from CurrentBar to find how many bars have elapsed since then.

    Or, you could subtract that variable from CurrentBar+1 if you want to include the bar the time was during.

    See the attached example script demonstrating this.

    Let us know if we may assist further.
    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      nice, thanks Brandon!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X