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 geotrades1, Today, 10:02 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by ender_wiggum, Today, 09:50 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by rajendrasubedi2023, Today, 09:50 AM
              1 response
              11 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by bmartz, Today, 09:30 AM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by geddyisodin, Today, 05:20 AM
              3 responses
              26 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X