Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to match bars separated in time? (OnRender)

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

    How to match bars separated in time? (OnRender)

    Hi guys,

    * Each bar has an X and a Y, but how do you store and match them to find the X and Y of the lower low (LL) bar?
    In other words,
    * When the white circled bar on the right is the current bar, how from it I refer to the white circled bar on the left to find the X and Y of the LL bar?
    * When the orange circled bar on the right is the current bar, how from it I refer to the orange circled bar on the left to find the X and Y of the LL bar?​

    Click image for larger version

Name:	1529-w.png
Views:	113
Size:	12.4 KB
ID:	1222398

    My indicator is written in OnRender, I'm storing and using the X and Y of the four most recent bars.
    But, how to store and use the X and Y of bars separated in time?​​

    If anyone can help...
    Thanks​

    #2
    I would use OnBarUpdate() and simply use the MIN() method using the number of bars from condition A to Condition B.

    double myBarLowY = MIN(Low, NumberofBars)[0]; // https://ninjatrader.com/support/help...inimum_min.htm

    For the X use LowestBar() method: https://ninjatrader.com/support/help...?lowestbar.htm (Note that this returns a bars ago from the currentbar so you would need to translate that to a bar number (if you need the value in OnRender).

    It seems somewhat wasteful to repetitively do (search for the LL bar) this in OnRender() which is why i am suggesting to use existing methods in OnBarUpdate(). You really only need to run these once per bar update.

    Otherwise in OnRender() you would need to loop through the bars and save the Lowest Low and Bar number into two variables within OnRender.

    Comment


      #3
      Hello rafaelcoisa,

      Thanks for your post.

      Tasker-182 is correct. You could use the MIN() method using the number of bars from condition A to Condition B in OnBarUpdate().

      MIN(): https://ninjatrader.com/support/help...inimum_min.htm

      The LowestBar() method could be used to get the number of bars ago the lowest price value occurred within the specified look-back period.

      LowestBar(): https://ninjatrader.com/support/help...?lowestbar.htm

      Let me know if I may assist further.
      <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

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      627 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      359 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      562 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      567 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X