Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 AaronKoRn, Today, 09:49 PM
          0 responses
          6 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          8 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          9 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,975 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X