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

Any way to plot values you get from your indicator into a table/board shown on chart

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

    Any way to plot values you get from your indicator into a table/board shown on chart

    Hello

    I would like to know if there is any way, maybe a "built-in" way to plot, or insert, a kind of table or board into a custom indicator, to display any kind of values you obtain in the indicator, like fixed text, numerical variable values, etc., for example to display this kind of tables in an extra panel into a chart window with the information you specify into the custom indicator, having as result something similar like the table in the panel 2 in the attached picture.

    I did a quick search into the "Drawing":

    And what I found was text, textboxes, lines, ... but couldn't see anything similar to a table to print fixed text and variable values.

    I hope there is a way to do this because I'm actually using a textbox that works fine for a simple list, but a table would be most useful to display extra information in a more organized way and make better use of the space.

    Maybe is there any open source indicator that shows the code to build this?

    I thank you all the information you can provide

    Click image for larger version  Name:	NT8 Chart with custom table.PNG Views:	0 Size:	82.6 KB ID:	1144998
    Last edited by futurenow; 03-05-2021, 07:54 AM.

    #2
    Hello futurenow,

    Thank you for the post.

    This type of drawing would need to be done using OnRender, I am not aware of anything existing for creating tables.You would need to basically just calculate the rectangle size and offset the X for each new rectangle.


    There is a sample called SampleCustomRender that comes with NinjaTrader and shows the basics of rendering text and other shapes. That system relies on x/y coordinates instead of being associated with bar/price. You can use conversion methods to convert the bar and price data to x/y.

    A lot of items in the platform use OnRender like the drawing objects so there are many examples of using OnRender included. You can use visual studio to do a find all in solution for OnRender to find every example. This is a more complex topic so using existing samples in the platform is a good way to learn how the rendering works.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Futurenow, can I please see the code on how you produced these rectangles and text? I have a Probability Matrix I created for TradingView that I'm converting to NT but not sure how to display the output into a table on another panel rather than refer to the databox. The matrix has a total of 66 cells so the databox would be more difficult to refer to.

      Comment


        #4
        Originally posted by Lance El Camino View Post
        Futurenow, can I please see the code on how you produced these rectangles and text? I have a Probability Matrix I created for TradingView that I'm converting to NT but not sure how to display the output into a table on another panel rather than refer to the databox. The matrix has a total of 66 cells so the databox would be more difficult to refer to.

        Hello

        Oh, what you see in that feb 2021 post was not a NinjaTrader 8 indicator, it was just a drawn mock-up about the idea I had in mind at that time.

        About what you need there is another post where I think I talk about a similar situation. I've seen some possible ways to do this, but I don't have any final implementation yet because I have that paused for the moment, however here is the link:

        Hello I would like to know how I can have a kind of colored dynamic labels in a similar way like for example I’ve seen the Thinkorswim platform shows in its charts, but of course in NinjaTrader 8. For now, the most approximate concept I’ve seen in NT8 is to have the stats information in the Market Analyzer



        So, the lighter way to do this in terms of PC resources efficiency I think it would be with 'Draw.TextFixed​()', but when you need multiple rows of cells then it only works visually fine if the cells will have a fixed text length (fixed size), i.e. the text and/or the variables printed values have the exact text length (for example always 8 digits, or always 5 digits,...).

        I attached a basic sample that works with 'Draw.TextFixed()' sentences. In this case the indicator works with multiple 'Draw.TextFixed()' sentences because each "cell" could have its own color, but in other situation where all the cells will have the same color or transparent color, then the process can be done in a single 'Draw.TextFixed()' sentence.


        Another alternative is to use as base the indicator called "SampleCustomRender", that I think it comes pre-installed in NinjaTrader 8. You can try with it and in case you get the desired grid/table result then you can attach a sample here to have that different alternative.

        Good luck!
        Attached Files

        Comment


          #5
          Thank you!

          Comment


            #6
            Here's a simple "one liner". It has a flaw - wide bottom margin just to offset it from the other text. But I found it convenient just to use a single Draw.TextFixed() statement and organize everything in it.

            Code:
                        Draw.TextFixed(this, "Labels",
                        "EMA1 = " + (EMA1[0]) +
                        "\nEMA2 = " + (EMA2[0]) +
                        "\nEMA3 = " + (EMA3[0]) +
                        "\n",
                        TextPosition.BottomLeft,
                        ChartControl.Properties.ChartText,
                        ChartControl.Properties.LabelFont, Brushes.Black, Brushes.Black, 50);​
            this is what it looks like on the chart:
            xcoder
            NinjaTrader Ecosystem Vendor - EMS

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Today, 06:40 PM
            0 responses
            9 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            7 views
            0 likes
            Last Post maybeimnotrader  
            Started by quantismo, Today, 05:13 PM
            0 responses
            7 views
            0 likes
            Last Post quantismo  
            Started by AttiM, 02-14-2024, 05:20 PM
            8 responses
            168 views
            0 likes
            Last Post jeronymite  
            Started by cre8able, Today, 04:22 PM
            0 responses
            9 views
            0 likes
            Last Post cre8able  
            Working...
            X