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

Problems with Draw.Dot, Draw.TriangleUp, etc

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

    Problems with Draw.Dot, Draw.TriangleUp, etc

    Hello,

    This piece of code:

    protected override void OnBarUpdate()
    {
    //Add your custom indicator logic here.
    if (CurrentBar < 1) return;

    if (Close[0]>Close[1])
    Draw.TriangleUp(this, "tag2", true, 0, Low[0] - 1*TickSize, Brushes.Blue);

    }

    compiles just fine, but does nothing to the chart. The triangles (or dots) are not being drawn as they are in NT 7 where I use this piece of code:

    DrawTriangleUp(CurrentBar.ToString(), true, 0, Low[0] - 1*TickSize, Color.Blue);

    What is wrong here? Any help in resolving this issue would be appreciated.

    Thanks.

    #2
    Hello,

    Thank you for the post.

    The fundamental difference between these two lines of code is the Tag being used, in your NT7 code you have a unique tag and in the NT8 code you do not:

    Code:
    DrawTriangleUp([B]CurrentBar.ToString()[/B], true, 0, Low[0] - 1*TickSize, Color.Blue); 
    
    Draw.TriangleUp(this, [B]"tag2"[/B], true, 0, Low[0] - 1*TickSize, Brushes.Blue);
    The NT8 code would only draw 1 triangle on the entire chart, the NT7 code would draw multiple. To make this the same you could use the same code:

    Code:
    Draw.TriangleUp(this, [B]CurrentBar.ToString()[/B], true, 0, Low[0] - 1*TickSize, Brushes.Blue);
    Or to be less generic to prevent future problems in case you add more objects, a more correct solution would be:

    Code:
    Draw.TriangleUp(this,[B] "SomeTag" + CurrentBar[/B], true, 0, Low[0] - 1*TickSize, Brushes.Blue);

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse, thanks! That does appear to have solved my problem.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,227 views
      0 likes
      Last Post xiinteractive  
      Started by andrewtrades, Today, 04:57 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      7 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      440 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      11 views
      0 likes
      Last Post FAQtrader  
      Working...
      X