Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 RookieTrader, Today, 07:41 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by kujista, Today, 05:44 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by elderan, Yesterday, 08:03 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by samish18, Yesterday, 08:57 AM
          8 responses
          25 views
          0 likes
          Last Post samish18  
          Started by DJ888, 04-16-2024, 06:09 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X