Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Update a Line already drawn via a Strategy?

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

    How to Update a Line already drawn via a Strategy?

    Hi,

    Hoping you may be able to help please.

    When certain criteria are met, I draw a dotted line to the Chart and store the Y value and CurrentBar for when the line begins into variables:

    Code:
    Draw.Line(this, "NewLine"+CurrentBar, false, 0, NewLineValue, (0-120),NewLineValue, Brushes.Blue, DashStyleHelper.Solid, 4);
    In subsequent bars when certain conditions are met, I wish to "go back" and update the line to end sooner than the originally planned 120 bars. E.g. 15 bars later something happens, and I wish to cut the already added 120 bar line down to 15 bars.

    Is it possible to update/edit a line that has already been drawn to the chart?

    Many thanks in advance

    ChainsawDR

    #2
    Hello ChainsawDR,

    Thanks for your post.

    Yes, you can redraw the line with new parameters. To do so you would want to save the tag name of the line when it is created and then if/when you update later you can reuse the tag name and this will automatically remove the older line and replace it with the new line with the new properties.

    Comment


      #3
      Works a treat, thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      55 views
      0 likes
      Last Post CarlTrading  
      Working...
      X