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

Drawing Text info

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

    Drawing Text info

    Hi all.

    Is it possible to draw text as a vertical string and how to find the y coordinate to have the text always on the same position when scrolling chart?

    Thanks.

    #2
    Are you trying to do something like this?

    DrawTextFixed("myText", "h \no \nm \ne \n", TextPosition.TopLeft);


    If you don't want one of the pre-defined text location you would have to create your own formula for finding the desired Y/X location on the chart.

    This is unsupported but you could look into the ChartControl properties if you wanted to do something like that
    Attached Files
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thanks. I'd like to have text as vertical string, but not each letter below the other. Anyway the one you suggested could be useful too. I just need to have text on defined bars (more than one) aligned with top of the chart (just below the icon menu) whichever the price is. (See picture)
      Attached Files

      Comment


        #4
        There isn't a supported way to do this but it would be possible if you override the Plot()



        Learn how to create vertical text using a StringFormat with supporting illustrations, descriptions and links.


        Let me know if I can be of further assistance.
        LanceNinjaTrader Customer Service

        Comment


          #5
          Thanks. I'm using a UserDefinedMethod as Indicator. How can I integrate the overriding of the Plot() into it?

          Comment


            #6
            Originally posted by MAX View Post
            Thanks. I'm using a UserDefinedMethod as Indicator. How can I integrate the overriding of the Plot() into it?
            You do not want to override the Plot() from inside a partial class: override the Plot() in the indicator where you want the override.

            Comment


              #7
              Thanks koganam.

              Comment


                #8
                I tried to use Plot() on indicator, but I'm visualizing text only once.

                I need to have text showed on a specific point of chart if a condition is true (so more than once at the same time).

                Let's say I want text just below the chart frame at one or more specified dates.

                I have seen the CustomPlotSample, but I don't understand how to locate the position on chart if a specified date or bar is found.

                Thanks

                Comment


                  #9
                  Originally posted by MAX View Post
                  I tried to use Plot() on indicator, but I'm visualizing text only once.

                  I need to have text showed on a specific point of chart if a condition is true (so more than once at the same time).

                  Let's say I want text just below the chart frame at one or more specified dates.

                  I have seen the CustomPlotSample, but I don't understand how to locate the position on chart if a specified date or bar is found.

                  Thanks
                  Have you already managed to create your vertical text?

                  Comment


                    #10
                    Yes. I found a way on MSDN, but I have the string only once, while I need it everytime a specified data is found and at the same coordinate on the visible chart. I tried with a for cycle but doesn't work.

                    Something like the excel picture attached.

                    Thanks.
                    Attached Files

                    Comment


                      #11
                      Originally posted by MAX View Post
                      Yes. I found a way on MSDN, but I have the string only once, while I need it everytime a specified data is found and at the same coordinate on the visible chart. I tried with a for cycle but doesn't work.

                      Something like the excel picture attached.

                      Thanks.
                      Very nice. Unfortunately, it is hard to say without seeing your actual drawing code scheme, so how you would go about it may be very different from how I would do so. Essentially, you need to be able to fix your drawing relative to the bars.

                      If you are indexing by barNumber, one way would be to use a Dictionary using the barNumber as TKey and the required text as TValue. You then read the Dictionary to draw the objects.

                      Indexing by x-value would be considerably more difficult, as you then need to recalculate the x-value on each pass.
                      Last edited by koganam; 10-14-2013, 11:45 AM. Reason: Corrected spelling.

                      Comment


                        #12
                        Have you got any example on how to use Dictionary and TKey, TValue?

                        Thanks.

                        Comment


                          #13
                          Originally posted by MAX View Post
                          Have you got any example on how to use Dictionary and TKey, TValue?

                          Thanks.
                          Unfortunately, I do not have any examples that I can share, so I would best refer you to the source: http://msdn.microsoft.com/en-us/library/xfhwa508.aspx

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by wzgy0920, 04-20-2024, 06:09 PM
                          2 responses
                          26 views
                          0 likes
                          Last Post wzgy0920  
                          Started by wzgy0920, 02-22-2024, 01:11 AM
                          5 responses
                          32 views
                          0 likes
                          Last Post wzgy0920  
                          Started by wzgy0920, Yesterday, 09:53 PM
                          2 responses
                          49 views
                          0 likes
                          Last Post wzgy0920  
                          Started by Kensonprib, 04-28-2021, 10:11 AM
                          5 responses
                          192 views
                          0 likes
                          Last Post Hasadafa  
                          Started by GussJ, 03-04-2020, 03:11 PM
                          11 responses
                          3,234 views
                          0 likes
                          Last Post xiinteractive  
                          Working...
                          X