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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X