Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Updating a Line

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

    Updating a Line

    Hello,

    I would like to know if its possible how to update a line that has been drawn on screen.

    e.g. Draw.Line(this, "FirstUpLine", false, 5, Low[5], 1, High[1], Brushes.DodgerBlue, DashStyleHelper.Solid, 4);

    When certain conditions are met, this line is drawn as seen in the attached photo. What I would like to do is when a Higher High appears, I want the end anchor point to keep moving to the next high Which is Bar 7, then finally will end up into Bar 8.
    Attached Files

    #2
    Hello Don, thanks for writing in. You can save your Line object as a class member and change its Start and End Anchor points at a later time e.g.

    Code:
            bool drawonce = false;
            NinjaTrader.NinjaScript.DrawingTools.Line myLine;
            protected override void OnBarUpdate()
            {
                if(State != State.Realtime)
                    return;
    
                if(!drawonce)
                {
                    myLine = Draw.Line(this, "tag1", 0, High[0], 10, High[10], Brushes.Red);
                    drawonce = true;
                }
                else
                {
                    myLine.StartAnchor.Price = High[0];
                    myLine.StartAnchor.SlotIndex = CurrentBar;
                }
    
            }​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 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
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X