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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          142 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          81 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          125 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          120 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          98 views
          0 likes
          Last Post CarlTrading  
          Working...
          X