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

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 llanqui, Today, 10:32 AM
        0 responses
        1 view
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by StockTrader88, 03-06-2021, 08:58 AM
        45 responses
        3,992 views
        3 likes
        Last Post johntraderuser2  
        Started by TAJTrades, Today, 09:46 AM
        0 responses
        7 views
        0 likes
        Last Post TAJTrades  
        Started by rhyminkevin, Yesterday, 04:58 PM
        5 responses
        62 views
        0 likes
        Last Post dp8282
        by dp8282
         
        Started by realblubb, Today, 09:28 AM
        0 responses
        8 views
        0 likes
        Last Post realblubb  
        Working...
        X