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

DrawText and backColor

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

    DrawText and backColor

    Hello,
    When I use the DrawText feature and also use the outlineColor and/or the backColor they dont really line up or center properly with the text used. They always seem to plot alittle off center to the right. I would like the text used to be centered in the backColor. Is there a way to adjust the oulineColor and backColor to center them with the text used?
    Does the "double y" and/or "double ypixelOffset" do this? If so, how?

    Thanks

    DrawText(string tag, bool autoScale, string text, int barsAgo, double y, double yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color backColor, int opacity)

    #2
    dwalls,

    It should align by default. Please try a standard font like Arial.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,
      Here is a screenshot.
      The backColor and the text seem to line up on the left edge together. The text is not centered in the backColor. Any text or backColor I try does the same thing.
      The farther I move the text to the right the offset between the text and the backColor gets worse.
      I was just wondering if it designed to line up on the left edge like that or can the text be more centered in the backColor somehow?

      Thanks
      Attached Files

      Comment


        #4
        Sorry...I did try Arial and had the same result.

        Thanks

        Comment


          #5
          dwalls,

          Please try adding some spaces to your string. So like instead of "96.3" do " 96.3" etc.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks Josh,
            I tried that and it will just move the backColor over with it.
            There doesnt appear to be a way to center the text using the standard DrawText text and backColor.

            If anyone can figure out a way to do this, please let me know.

            Thanks

            Comment


              #7
              Hi,
              If you look at any Price Markers in the right margin, thats what I was trying to achive with this backColor. The text to be centered in the middle of the backColor.
              Maybe theres something in the Price Markers code that would help.

              Thanks

              Comment


                #8
                dwalls,

                Unfortunately there is not. You will have to do your own overriding of the Plot() method if the DrawText() does not meet your requirements.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by dwalls View Post
                  Hi,
                  If you look at any Price Markers in the right margin, thats what I was trying to achive with this backColor. The text to be centered in the middle of the backColor.
                  Maybe theres something in the Price Markers code that would help.

                  Thanks
                  I'm sure there is a C# way to do something, but I am not that sophisticated. I tried using something like str.PadLeft(5, ' ') but a space is not recognized as a character so the background coloring doesn't apply to it. The char map of a blank copied into the char assignment is ignored also, leaving you only with locating the least-obtrusive char to use (like str.PadLeft(5,'.') - or if you can find an even smaller char).

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by lorem, Yesterday, 09:18 AM
                  4 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by Spiderbird, Today, 12:15 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post Spiderbird  
                  Started by cmtjoancolmenero, Yesterday, 03:58 PM
                  12 responses
                  42 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by FrazMann, Today, 11:21 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post FrazMann  
                  Started by geddyisodin, Yesterday, 05:20 AM
                  8 responses
                  52 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X