Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawRay() and the *next* bar

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

    DrawRay() and the *next* bar

    Let's say I use DrawRay() to draw a ray from Open[2] to Open[1]. Is there a way to tell when the CurrentBar closes if Open[0] is above or below the extended ray? I guess I would need to know the price where the ray would intersect each future bar.

    Thanks!
    Bryan

    #2
    Yes, this is possible with some advanced programming. For an example, look at the code in the Automatic Trend Line indicator at this link:
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      Yes, this is possible with some advanced programming. For an example, look at the code in the Automatic Trend Line indicator at this link:
      http://www.ninjatrader-support.com/v...ks.php?catid=1
      Well that's funny, because that's the code that I was modifying! :-)

      Ok, so where in that code is it determining what the value of the extended ray is -- when it's finding out whether the trendline has been crossed?

      Comment


        #4
        In the code there are comments, something like "Check for trend line break" etc...This is from memory. You will have to rip through the code to understand what is happening. In a nutshell, it grabs the xy values of the start and end point of the trend line and calculates the slope (change per bar) and then add this to each subsequent bar to determine the line value which then can be checked against the close price etc...
        RayNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          In the code there are comments, something like "Check for trend line break" etc...This is from memory. You will have to rip through the code to understand what is happening. In a nutshell, it grabs the xy values of the start and end point of the trend line and calculates the slope (change per bar) and then add this to each subsequent bar to determine the line value which then can be checked against the close price etc...
          Yes, thank you, that's what I thought too. Now where are those old geometry books... ;-)

          Bryan

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          579 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X