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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      72 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X