Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overlapping in price

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

    Overlapping in price

    I am really grateful for the support. I am almost done with my little indicator but I need an extra help. Is there any function in NinjaTrader that check if there is any price overlap between two bars?

    I want to know if bar[2] overlaps with bar[0] at any point. Better said, if both bars share a single tick at any point (open to close range). How would you approach this challenge?



    Regards

    #2
    Hello,
    Thanks for writing in today.

    I am little confused on the question you are asking. If you could clarify what data are you comparing to see if a tick is shared or not.

    Are you comparing two data series?

    I look forward to your reply and offering further assistance.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Sure, see attached picture...
      Attached Files
      Last edited by MillenniumTrader; 04-29-2015, 02:24 PM.

      Comment


        #4
        Hello,
        Thanks for the diagram and clarification.

        This can be done by checking to see if a value that exists between the open and close of bar[0] and the open and close of bar[2].

        If this condition statement is true then they would share a value between the two bars.

        Here is an example to check if a Close[0] exists between the Open[2] and Close[2]
        Code:
        if (Close[0] <= Open[2] && Close[0] >= Close[2])  || 
           (Close[0] >= Open[2] && Close[0] <= Close[2]) 
        {
        
        //Close[0] exists between Open[2] and Close[2]
        
        }
        Notice we must check both Open[2] being a greater value than Close[2] and the converse as this bar could have a higher Close[2] than Open[2] value.

        Use the above example to add a check to see if the Open[0] exists between the Open[2] and Close[2] value to make your condition statement complete.

        Please let us know if we may be of further assistance for anything NinjaTrader.
        Alex G.NinjaTrader Customer Service

        Comment


          #5
          Thank you for the solution. It worked beautifully. I had to readjust for high and low on the conditions.

          Thanks a lot for your help

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          633 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 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
          567 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X