Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to DrawText on every Bar

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

    How to DrawText on every Bar

    Hello,

    i want a drawtext on every Bar with a Value.

    How can i do this with this Code:

    Code:
    // Check if we have received a tick on the primary Chart
                if (BarsInProgress == 0 && CurrentBar > 0 && IsFirstTickOfBar)
                {
                    macdValue = macd1.Value[0];
                    macdValue2 = macd1.Value[1];
                    Draw.Text(this, "1" , "T", 1,  Low[0], Brushes.White);}
    ​
    This is want i want but i will not work

    Draw.Text(this, Unique ID (so its not delete on every Bar) , (macdValue-macdValue2).toString, 1, Low[0], Brushes.White);
    Last edited by Dirales; 05-02-2023, 02:15 AM.

    #2
    I Found a way:

    Draw.Text(this, "MacdDiff" + CurrentBar , macdValue3.ToString("N3"), 0, Low[0] -2, Brushes.White);

    Comment


      #3
      Yes, the "tag" parameter of the draw method has to be unique for each bar if you want it to have one on each bar. Any time you Draw with the same tag as before you're telling the indicator to replace the old one with the new one.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment


        #4
        Hello Dirales,

        This is correct, use a unique tag name.

        Below is a link to a forum post that discusses.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X