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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          156 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          90 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          138 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          130 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          107 views
          0 likes
          Last Post CarlTrading  
          Working...
          X