Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set EndBarsAgo propety of Region?

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

    How to set EndBarsAgo propety of Region?

    Hello.

    In NT7 I make regions this way:
    Code:
    IRegion Up_Zone;
    
    void override OnStartUp()
    {
    Up_Zone = DrawRegion("Up_Zone", 0, 0, LineUp1, LineUp2, Color.Empty, Color.Blue, 10 );	
    }
    
    void override OnBarUpdate()
    {
    Up_Zone.EndBarsAgo = 0;	
    }
    This works fast. But, as for as I see - this way is not valid in NT8.

    So, how can I do same in NT8 in correct way?

    Thank You.
    Last edited by fx.practic; 08-21-2016, 07:08 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Have you looked at "Draw.RegionHighlightY()" or "Draw.RegionHighlightX()"?

    I believe that might do what you are looking for.
    Last edited by armybender; 08-20-2016, 07:38 PM.

    Comment


      #3
      Here is the answer:

      Code:
      Up_Zone.EndAnchor.DrawnOnBar   = 0; 
      Up_Zone.StartAnchor.DrawnOnBar = CurrentBar;
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello fx.practic,

        The general supported way to move or modify a drawing object is to call the drawing object again with the same tag name. This is so that if there are any internal methods they called / updated when the object is constructed.

        For example in NT7:
        protected void OnBarUpdate()
        {
        DrawRegion("Up_Zone", 0, 0, LineUp1, LineUp2, Color.Empty, Color.Blue, 10 );
        }

        or in NT8:
        protected void OnBarUpdate()
        {
        Draw.Region(this, "Up_Zone", 0, 0, LineUp1, LineUp2, Brushes.Transparent, Brushes.Blue, 10);
        }

        If you find any odd or undesired behavior, I would recommend using the supported way of modifying a drawing object.
        Last edited by NinjaTrader_ChelseaB; 08-22-2016, 11:13 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I didn't make measurements on NT8, but on NT7 "my" method work about 5-8 times faster.

          Thank You for Your answer.
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ScottWalsh, 04-16-2024, 04:29 PM
          6 responses
          27 views
          0 likes
          Last Post ScottWalsh  
          Started by frankthearm, Today, 09:08 AM
          10 responses
          35 views
          0 likes
          Last Post frankthearm  
          Started by GwFutures1988, Today, 02:48 PM
          0 responses
          3 views
          0 likes
          Last Post GwFutures1988  
          Started by mmenigma, Today, 02:22 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by NRITV, Today, 01:15 PM
          2 responses
          9 views
          0 likes
          Last Post NRITV
          by NRITV
           
          Working...
          X