Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Extending rectangles

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

    Extending rectangles

    I'm trying to extend all objects Endpoints to the right that have a certain name on the chart.


    PHP Code:
     protected override void OnBarUpdate()
     {
    foreach (IDrawObject draw in DrawObjects)    
        {
             if (draw.Tag.Contains("Rect") && draw.DrawType is IRectangle)
                {
                    IRectangle Extend = (IRectangle) draw;
                    Extend.EndBarsAgo = BarsInProgress - 10;
                }    
        }
    } 
    

    would this not work? Any ideas?
    Last edited by APA Zones; 03-27-2011, 08:28 PM.

    #2
    doubletop, this code could definitely work. Are you having issues with it?
    AustinNinjaTrader Customer Service

    Comment


      #3
      No it's not working. I can extend the rectangles through other parts of the code, however the onbarupdate code that I does not seem to be working at all.
      According to my output window it is not going into that routine at all. The other thing that I wonder is maybe having more then one zone makes it an impossible calculation. Depending on the chart I could have a hundred of these open zones or rectangles going at any one time.
      Last edited by APA Zones; 03-27-2011, 08:27 PM.

      Comment


        #4
        doubletop, what other parts of the code does this work correctly for? I just tried to extend the rectangles in OnMarketData() with your code and it didn't work. Can you post the code you're using that does work correctly?
        AustinNinjaTrader Customer Service

        Comment


          #5
          PHP Code:
          protected override void OnBarUpdate() 
           { 
          foreach (IDrawObject draw in DrawObjects)     
              { 
                   if (draw.Tag.Contains("Rect") && draw is IRectangle) 
                      { 
                          IRectangle Extend = (IRectangle) draw; 
                          Extend.EndBarsAgo = BarsInProgress - 10; 
                      }     
              } 
          
          draw is IRectangle was the key not draw.type
          Last edited by APA Zones; 03-28-2011, 09:53 PM.

          Comment


            #6
            Hi doubletop, so with this code change it works now correctly for you or not?

            Thanks,

            Comment


              #7
              it works correctly. it's extending all rectangles with that particular name to the right edge. I have a feeling that I'm using a "ton" of extra cycles just to do that. I may try to limit that a little when I have a few hundred rectangles doing that over and over, but it works

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              578 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