Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Text with TextPosition Error

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

    Draw.Text with TextPosition Error

    Guys, we are seeing a problem when trying to import an indicator that uses Draw.Text and allows the user to select the text position with a common input like this:

    [NinjaScriptProperty]
    [Display(Name = "Text Box Position", Description = "Position of text on chart.", GroupName = "Settings", Order = 1)]
    public TextPosition MyTextBoxPosition
    {
    get {return textBoxPosition;}
    set {textBoxPosition= value;}
    }

    where textBoxPosition is a previously defined variable:

    private TextPosition textBoxPosition = TextPosition.BottomRight;

    Importing the protected assembly produces an error message saying "error: CS0246: The type or namespace name 'TextPosition' could not be found..." The same problem (or nearly the same) appears to have been reported on March 16, 2016:

    http://ninjatrader.com/support/forum...ad.php?t=83901

    and Matthew reports then that it was scheduled to be resolved in 'B11 - NTEIGHT-9577'. We can work around it, but is there any resolution to this issue?

    Thanks for your help!

    Light

    #2
    Hello Light,

    I was able to replicate and have passed this on to development.

    Thank you for your report.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Alan. I'll look for the solution in an upcoming release. Until then, we'll use a work-around.

      Thanks again,

      Light

      Comment


        #4
        Hello Light,

        To update you on the issue.

        Using a type which is defined in NT's native Drawing Tool sources such as Text.Position.Bottom right in your code which is being compiled to a protected assembly, should not be done. You should instead create your own source code to prevent the issue, then re-export and provide that file to user.

        Please see the following section of our helpguide,
        http://ninjatrader.com/support/helpG...assemblies.htm

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I ran into the same issue and already read the helpguide section. I wan the same behaviour than Draw.TextFixed. How to implement my own Draw-Method the rigth way. Could you please provide the sourcecode:

          public static class MyDrawCustom
          {

          }

          Comment


            #6
            Hello DarthTraderson,

            I will follow up with you in the morning with an example.

            Thank you for your patience.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Hello DarthTraderson,

              Thank you for your patience.

              The following link contains a sample written by Jesse which can be exported as a complied assembly.

              https://ninjatrader.com/support/foru...61&postcount=4

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                there should be obviously workaround from NT devs, not from us, creating custom sources for drawingtools or etc.
                Last edited by ttodua; 06-27-2018, 06:45 AM.

                Comment


                  #9
                  Hello TazoTodua,

                  You should not be using types which are defined in NT’s native Drawing Tool sources. You should instead create your own in the code to prevent this issue.

                  See the note in the help guide titled, Exporting custom drawing tools as assembly / DLL
                  https://ninjatrader.com/support/help...assemblies.htm

                  Please let us know if you need further assistance.
                  Alan P.NinjaTrader Customer Service

                  Comment


                    #10
                    AlanP.
                    frankly speaking, we can't create our extensive custom codes for just to use Draw.TextFixed in compiled indicators.

                    btw, here is solution: https://trading.codes/tutorials/fix-...-not-be-found/
                    Last edited by ttodua; 02-23-2021, 12:29 AM.

                    Comment


                      #11
                      Hello TazoTodua,

                      Thank you for providing the solution to the forum, this is helpful.

                      Please let us know if you need further assistance.
                      Alan P.NinjaTrader Customer Service

                      Comment


                        #12
                        ttodua,

                        the link to the solution isn't valid anymore.
                        I have the same issue and don't want to rewrite a complete draw library.
                        could you please point out the solution to me?

                        many tanks in advance!

                        Comment


                          #13
                          Hello wjadevries,

                          You can create your own enum property and cast it to NinjaTrader.NinjaScript.DrawingTools.TextPosition.

                          Code:
                          Draw.TextFixed(this, "tag", "Text", (NinjaTrader.NinjaScript.DrawingTools.TextPosition)TextPos);
                          Code:
                          namespace MyEnums
                          {
                              public enum TextPosDLL
                              {
                                  BottomLeft,
                                  BottomRight,
                                  Center,
                                  TopLeft,
                                  TopRight
                              }
                          }
                          I have attached an example.

                          We look forward to assisting.
                          Attached Files
                          JimNinjaTrader Customer Service

                          Comment


                            #14
                            Already phsed out the TextPosition property and introduced my own.

                            But thanks!

                            Comment


                              #15
                              Hello Jim,

                              Wait a sec, an enum can be casted just like that in DLL?!? That would have been SOOO useful to know that. I used enum.parse and had a fun time (not) figuring it out haha.

                              Code:
                              // In this case I was pulling an enum property from a tool template
                              var enumProp = newEnumObject.GetType().GetProperty(newEnum);
                              Enum.Parse(enumProp.PropertyType, xmlNodeList_ENUM[newSelectElementAt].InnerText); //
                              Last edited by Unsuitable; 02-23-2021, 05:13 PM.
                              Unsuitable
                              NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bolenohuye, Today, 03:43 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post bolenohuye  
                              Started by kabott, Today, 03:17 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post kabott
                              by kabott
                               
                              Started by Jacklugate, Today, 02:36 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jacklugate  
                              Started by Jmgheosjrue, Today, 02:23 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jmgheosjrue  
                              Started by jodiesutton, Today, 01:55 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post jodiesutton  
                              Working...
                              X