Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need some help with drawing rays

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

    Need some help with drawing rays

    Hi,

    This is the code I have:-

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]
    if (Low[1]<Low[0] && Low[1]<Low[2])
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]  {
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]   DemandPoint.Set(Low[1]);
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]   DrawSquare("DP1"+CurrentBar, true, 1, Low[1], Color.Red);
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]  }
    [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    What I would like to do is to DrawRay points identified in the DemandPoint DataSeries IF the newer points at the right of the chart are greater than their older counterparts.

    How would I go about doing that?

    Regards

    Kay Wai

    #2
    Hello,

    Thanks for the note.

    You would need to add another if statement on the drawing of the ray for if( DemandPoint[0] > DemandPoint[1])

    Or if you want to check more points back setup a for loop to iterate back through the data series for how many DemandPoints back you want to check.

    for (int i = 0; i > 10; i++)
    {
    if( DemandPoint[0] > DemandPoint[i]){
    isGreaterInTheFuture = true;
    }
    }

    if (isGreaterInTheFuture = true)
    {
    //Draw Ray
    }

    This is just one way you could do it, there are always multiple ways to do things in programming depending on what you need.

    Let me know if I can be of further assistance.


    Then if the condition is true draw your ray.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks for your prompt reply and the guidance Brett!

      That gives me a great place to start!

      Comment


        #4
        Hi Brett,

        This is trickier than I thought!

        1) If I want to use the 20 most recent Lows in the Dataseries DemandPoints as reference points and 2) compare them against the Lows stored in the same DataSeries which are prior to and also including these reference points. 3) If the Lows are less than any of the reference points or if the reference point Lows are lower than the more recent reference point Lows, I would like to DrawRays from those Lows through those reference points.

        Hope you can assist!

        Best Regards

        Kay Wai

        Comment


          #5
          Kay Wai, unfortunately we can't custom program indicators such as this. It sounds like you'll have to do a for loop to go through each of the last 20 points in your data series and then compare to Low[n] and draw rays where appropriate.

          Code:
          int count = 20;
          for (int i = 1; i < = count; i++)
          {
              if (Low[i] < DemandPoints[i])
               // draw ray
          }
          AustinNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          599 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          344 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          558 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          557 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X