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 BarzTrading, Today, 07:25 AM
      2 responses
      12 views
      1 like
      Last Post BarzTrading  
      Started by devatechnologies, 04-14-2024, 02:58 PM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by tkaboris, Today, 08:01 AM
      0 responses
      3 views
      0 likes
      Last Post tkaboris  
      Started by EB Worx, 04-04-2023, 02:34 AM
      7 responses
      162 views
      0 likes
      Last Post VFI26
      by VFI26
       
      Started by Mizzouman1, Today, 07:35 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X