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 tsantospinto, 04-12-2024, 07:04 PM
        7 responses
        126 views
        0 likes
        Last Post aligator  
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by PeakTry, Today, 10:49 AM
        0 responses
        2 views
        0 likes
        Last Post PeakTry
        by PeakTry
         
        Started by llanqui, Today, 10:32 AM
        0 responses
        5 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by StockTrader88, 03-06-2021, 08:58 AM
        45 responses
        3,994 views
        3 likes
        Last Post johntraderuser2  
        Working...
        X