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

Display numbers on screen

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

    Display numbers on screen

    Hi,

    How can I display numbers on the screen for the indicators?
    I have 4 plots in an indicator panel (panel 2 for example) and want to plot only one of them as a line but other three of them to display as numbers for the last bar instead of lines. I could not do that with the DrawText().

    Any help will be greatly appreciated.

    #2
    Hello Dowhk,

    Thank you for your post.

    For a non-programming solution, consider setting the lines to transparent and setting Price Markers to true.

    Otherwise using DrawText() is one way to do it. Let us know what you have so far.

    Below are some snippets for checking if the bar is the last bar. Different code is used depending on whether CalculateOnBarClose is set to true or false.

    When CalculateOnBarClose == false, then OnBarUpdate() is being called for the last bar on the chart:


    Code:
    if (CurrentBar == Bars.Count - 1)
    // Is last bar on chart

    When CalculateOnBarClose == true, then OnBarUpdate() is being called for the last closed bar on the chart, not the in-process bar:


    Code:
    if (CurrentBar== Bars.Count -2)
    // Is last bar on chart
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan, Thank you very much.

      I understand the LastBarOnChart.
      I am very new to NT and I don't know how to convert numbers to strings and display them on screen. I could not use the DrawText().

      Here is the chart to help my explanation:
      There are 4 indicator lines in the panel 2. I want to convert the magenta, cyan, and yellow lines to numbers and disply them on the upper right corner of the panel 2. I want to keep the green line as is but display numbers for others.

      Please, give me right directions.
      Attached Files
      Last edited by dowhk; 03-01-2010, 02:53 PM.

      Comment


        #4
        Hello Dowhk,

        You can use ToString() to convert a double value into a string.

        myDouble.ToString()

        The reference sample below provides more help on working with String objects:

        Manipulating String Objects
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,227 views
        0 likes
        Last Post xiinteractive  
        Started by andrewtrades, Today, 04:57 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        7 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        440 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        12 views
        0 likes
        Last Post FAQtrader  
        Working...
        X