Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The Draw.Line are deleted

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

    The Draw.Line are deleted

    Hi, perform on an indicator.
    2 Draw.Line and 2 PlotStyle.Triangle.
    But when I see the historical one, I only appear in the last 2 lines. And the previous lines are erased.
    The PlotStyle.Triangle. , they are not deleted.
    How can I make it so that I can see the lines without being deleted?
    Thanks.

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (State == State.SetDefaults) {
    AddPlot(new Stroke(Brushes.OrangeRed, 6), PlotStyle.TriangleDown, "down");
    AddPlot(new Stroke(Brushes.Blue, 6), PlotStyle.TriangleUp, "up");
    }

    protected override void OnBarUpdate()
    {

    if (CurrentBar <2)
    return;

    if ((Close[1] > Open[1])&&(Close[0] < Open[0]))
    {
    Sells[0] = Close[0]-(distindi*TickSize);
    Draw.Line(this, "tag1", false, 0, High[0]-(Canttics*TickSize), -2, High[0]-(Canttics*TickSize), Brushes.OrangeRed, DashStyleHelper.Solid, 2);

    }
    else if ((Close[1] < Open[1])&&(Close[0] > Open[0]))
    {
    Buys[0] = Close[0]+(distindi*TickSize);
    Draw.Line(this, "tag2", false, 0, Low[0]+(Canttics*TickSize), -2, Low[0]+(Canttics*TickSize), Brushes.OrangeRed, DashStyleHelper.Solid, 2);
    }
    }



    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Sells
    {
    get { return Values[1]; }
    }

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Buys
    {
    get { return Values[0]; }
    }

    #2
    give them a distinct name "tag1"+CurrentBar instead of just "tag1", "tag2"+CurrentBar instead of "tag2",

    Comment


      #3
      Hello iradielt,

      From the help guide:

      "2. Set unique tag values for each draw object, unless you intend for new draw objects to replace existing objects with the same tag. A common trick is to incorporate the bar number as part of the unique tag identifier. For example, if you wanted to draw a dot that indicated a buying condition above a bar, you could express it:

      Draw.Dot(this, CurrentBar.ToString() + "Buy", false, 0, High[0] + TickSize, Brushes.ForestGreen);"

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you very much for your help, I will try this and I will tell you the results.

        Comment


          #5
          Thank you very much, try it and it's working.

          Comment

          Latest Posts

          Collapse

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