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 CarlTrading, 03-31-2026, 09:41 PM
              1 response
              152 views
              1 like
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              89 views
              1 like
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              131 views
              2 likes
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              127 views
              1 like
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              107 views
              0 likes
              Last Post CarlTrading  
              Working...
              X