Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw multiple objects and take control after days when price touches the object

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

    Draw multiple objects and take control after days when price touches the object

    Hello I'm creating an indicator where it draws a RegionHighlightYas follows

    Draw.RegionHighlightY(this, "Example", true, highPrice, bottomPrice, Brushes.Blue, Brushes.DodgerBlue, 25);

    The thing is, I'd like to draw N RegionHighlightY depending on the days loaded, so if there are 3 days loaded, I'd like to draw 3. The thing is they can not be named "Example" because the ID should be different, which ID should I put?

    Then what I need is, onEachTick I need to calculate if the price is touching this RegionHighlightY, but it may be the first one drawn (from the first day loaded) and I need to react to that RegionHighlightY, any idea how can I do this?

    I'm guessing to have a loop looking for all the RegionHighlightY ID drawn and get the top/bot price and then having the High Low of the price react to this.

    Shorter explanation with example :

    I've load 5 days
    Day1 RegionHighlightY1
    Day2 RegionHighlightY2
    Day3 RegionHighlightY3
    Day4 RegionHighlightY4
    Day5 RegionHighlightY5

    Then as I am on Day5 the price may be in below some RegionHighlightY, so I need to get the one or ones RegionHighlightY that are in that area and react to this.

    #2
    Hello BrandonH,

    What's the efficient way to draw each object with different tag name? Imagine I add the tag MyRegion, what should I include next to it?

    Comment


      #3
      Hello BrandonH,

      I've made it, and it's drawing the regions I want, I'm using this :


      private Dictionary<DateTime, bool> regionsDrawn = new Dictionary<DateTime, bool>(); // Dictionary to store dates for which regions have been drawn​

      Because I want to draw just one region per day, is it ok? Is there any other efficient way to do so?

      Once I have this, I need to get the top and bottom for each drawing object drawn by my indicator, is there any way I can get getting the tag?

      Shall I use this instead?

      private Dictionary<DateTime, double[]> regionsTopPrices = new Dictionary<DateTime, double[]>();
      private Dictionary<DateTime, double[]> regionsBottomPrices = new Dictionary<DateTime, double[]>();

      Comment


        #4
        Hello BrandonH,

        Yes, I saw this, but is there any way I can get the top/bot from a RegionHighlightY? I couldn't find it anywhere, I need it because I need to know if the price have pierced it or not.

        Comment


          #5
          Hello cmtjoancolmenero,

          You can get this from the drawing object's anchors.


          RegionHighlightY myReg = Draw.RegionHighlightY(this, "tag1", 10, 0, Brushes.Blue);

          Print( "myReg.StartAnchor.Price: " + myReg.StartAnchor.Price + ", myReg.EndAnchor.Price: " + myReg.EndAnchor.Price );
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

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