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

indicator value in full number

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

    indicator value in full number

    Hi support-Team,

    with the support of bertrand, i use the folowing code in my indicator:

    DrawTextFixed("tag", "ê", TextPosition.TopLeft, Color.Red, new Font("Wingdings", 20), Color.Transparent, Color.Transparent, 0);

    DrawTextFixed("DEFalert"," since "+(CurrentBar-BarAtLastCross)+" Bars down - Value: "+(def),TextPosition.TopLeft, Color.Red, new Font("Arial", 12), Color.Transparent, Color.Transparent, 0);

    It shows an arrow and Text in my chart. At the end it shows a value +(def) from the indicator (56,1458965236587 for example).

    now i´m interested in two options:

    - show the value roundet to a full number (56 for example)
    - show the number in bigger letters, if it goes under 20 or over -20 in respect to zero

    Thanks for our Help!

    Pullbacktrader

    #2
    Pullbacktrader, for the rounding part you can use Math.Round from C#, so for example

    Math.Round(def, 2) would round it to 2 digits.

    Further, here's an example how you could dynamically update the second DrawTextFixed according to a custom condition -

    Code:
    if (ADX(14)[0] > 20)
    {
    	RemoveDrawObject("tag2");
    	DrawTextFixed("tag2", Math.Round(ADX(14)[0], 2).ToString(), TextPosition.TopLeft, Color.Red, new Font("Arial", 12), Color.Transparent, Color.Transparent, 0);
    }
    			
    if (ADX(14)[0] < 20)
    {
    	RemoveDrawObject("tag2");
    	DrawTextFixed("tag2", Math.Round(ADX(14)[0], 2).ToString(), TextPosition.TopLeft, Color.Red, new Font("Arial", 6), Color.Transparent, Color.Transparent, 0);
    }
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Wow, thank´s for your Help Bertrand! It works.

      Have a nice Day!

      Comment


        #4
        Glad to hear, have a nice day, too!
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Working...
        X