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 benmarkal, Yesterday, 12:52 PM
          3 responses
          22 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by helpwanted, Today, 03:06 AM
          1 response
          18 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          11 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          6 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          244 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Working...
          X