Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 = (IRectangledraw;
                    
    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 = (IRectangledraw
                          
          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,
            BertrandNinjaTrader Customer Service

            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 bmartz, 03-12-2024, 06:12 AM
              5 responses
              32 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              13 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X